<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=0.8"/><title>13&nbsp;类和对象</title><link rel="stylesheet" type="text/css" href="scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="racket.css" title="default"/><link rel="stylesheet" type="text/css" href="manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="manual-racket.css" title="default"/><script type="text/javascript" src="scribble-common.js"></script><script type="text/javascript" src="manual-racket.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="scribble-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_0&quot;);">&#9660;</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Racket&#25351;&#21335;</a></td></tr></table></div><div class="tocviewsublisttop" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1&nbsp;</td><td><a href="intro.html" class="tocviewlink" data-pltdoc="x">&#27426;&#36814;&#26469;&#21040;Racket!</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="to-scheme.html" class="tocviewlink" data-pltdoc="x">Racket&#27010;&#35201;</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="datatypes.html" class="tocviewlink" data-pltdoc="x">&#20869;&#32622;&#30340;&#25968;&#25454;&#31867;&#22411;</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="scheme-forms.html" class="tocviewlink" data-pltdoc="x">&#34920;&#36798;&#24335;&#21644;&#23450;&#20041;</a></td></tr><tr><td align="right">5&nbsp;</td><td><a href="define-struct.html" class="tocviewlink" data-pltdoc="x">&#31243;&#24207;&#21592;&#23450;&#20041;&#30340;&#25968;&#25454;&#31867;&#22411;</a></td></tr><tr><td align="right">6&nbsp;</td><td><a href="modules.html" class="tocviewlink" data-pltdoc="x">&#27169;&#22359;</a></td></tr><tr><td align="right">7&nbsp;</td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">&#21512;&#32422;</a></td></tr><tr><td align="right">8&nbsp;</td><td><a href="i_o.html" class="tocviewlink" data-pltdoc="x">&#36755;&#20837;&#21644;&#36755;&#20986;</a></td></tr><tr><td align="right">9&nbsp;</td><td><a href="regexp.html" class="tocviewlink" data-pltdoc="x">&#27491;&#21017;&#34920;&#36798;&#24335;</a></td></tr><tr><td align="right">10&nbsp;</td><td><a href="control.html" class="tocviewlink" data-pltdoc="x">&#24322;&#24120;&#19982;&#25511;&#21046;</a></td></tr><tr><td align="right">11&nbsp;</td><td><a href="for.html" class="tocviewlink" data-pltdoc="x">&#36845;&#20195;&#21644;&#25512;&#23548;</a></td></tr><tr><td align="right">12&nbsp;</td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">&#27169;&#24335;&#21305;&#37197;</a></td></tr><tr><td align="right">13&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">&#31867;&#21644;&#23545;&#35937;</a></td></tr><tr><td align="right">14&nbsp;</td><td><a href="units.html" class="tocviewlink" data-pltdoc="x">&#21333;&#20803;</a></td></tr><tr><td align="right">15&nbsp;</td><td><a href="reflection.html" class="tocviewlink" data-pltdoc="x">&#21453;&#23556;&#21644;&#21160;&#24577;&#27714;&#20540;</a></td></tr><tr><td align="right">16&nbsp;</td><td><a href="macros.html" class="tocviewlink" data-pltdoc="x">&#23439;</a></td></tr><tr><td align="right">17&nbsp;</td><td><a href="languages.html" class="tocviewlink" data-pltdoc="x">&#21019;&#36896;&#35821;&#35328;</a></td></tr><tr><td align="right">18&nbsp;</td><td><a href="concurrency.html" class="tocviewlink" data-pltdoc="x">&#24182;&#21457;&#19982;&#21516;&#27493;</a></td></tr><tr><td align="right">19&nbsp;</td><td><a href="performance.html" class="tocviewlink" data-pltdoc="x">&#24615;&#33021;</a></td></tr><tr><td align="right">20&nbsp;</td><td><a href="parallelism.html" class="tocviewlink" data-pltdoc="x">&#24182;&#34892;</a></td></tr><tr><td align="right">21&nbsp;</td><td><a href="running.html" class="tocviewlink" data-pltdoc="x">&#36816;&#34892;&#21644;&#21019;&#24314;&#21487;&#25191;&#34892;&#31243;&#24207;</a></td></tr><tr><td align="right">22&nbsp;</td><td><a href="More_Libraries.html" class="tocviewlink" data-pltdoc="x">&#26356;&#22810;&#30340;&#24211;</a></td></tr><tr><td align="right">23&nbsp;</td><td><a href="dialects.html" class="tocviewlink" data-pltdoc="x">Racket&#21644;Scheme&#30340;&#26041;&#35328;</a></td></tr><tr><td align="right">24&nbsp;</td><td><a href="other-editors.html" class="tocviewlink" data-pltdoc="x">&#21629;&#20196;&#34892;&#24037;&#20855;&#21644;&#20320;&#30340;&#32534;&#36753;&#22120;&#36873;&#25321;</a></td></tr><tr><td align="right"></td><td><a href="doc-bibliography.html" class="tocviewlink" data-pltdoc="x">Bibliography</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_1&quot;);">&#9658;</a></td><td>13&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">&#31867;&#21644;&#23545;&#35937;</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">13.1&nbsp;</td><td><a href="#%28part._methods%29" class="tocviewlink" data-pltdoc="x">&#26041;&#27861;</a></td></tr><tr><td align="right">13.2&nbsp;</td><td><a href="#%28part._initargs%29" class="tocviewlink" data-pltdoc="x">&#21021;&#22987;&#21270;&#21442;&#25968;</a></td></tr><tr><td align="right">13.3&nbsp;</td><td><a href="#%28part._intnames%29" class="tocviewlink" data-pltdoc="x">&#20869;&#37096;&#21644;&#22806;&#37096;&#21517;&#31216;</a></td></tr><tr><td align="right">13.4&nbsp;</td><td><a href="#%28part._.Interfaces%29" class="tocviewlink" data-pltdoc="x">&#25509;&#21475;</a></td></tr><tr><td align="right">13.5&nbsp;</td><td><a href="#%28part._inner%29" class="tocviewlink" data-pltdoc="x">Final&#12289;Augment&#21644;Inner</a></td></tr><tr><td align="right">13.6&nbsp;</td><td><a href="#%28part._extnames%29" class="tocviewlink" data-pltdoc="x">&#25511;&#21046;&#22806;&#37096;&#21517;&#31216;&#30340;&#33539;&#22260;</a></td></tr><tr><td align="right">13.7&nbsp;</td><td><a href="#%28part._.Mixins%29" class="tocviewlink" data-pltdoc="x">&#28151;&#21512;</a></td></tr><tr><td align="right">13.8&nbsp;</td><td><a href="#%28part._.Traits%29" class="tocviewlink" data-pltdoc="x">&#29305;&#24449;</a></td></tr><tr><td align="right">13.9&nbsp;</td><td><a href="#%28part._.Class-.Contracts%29" class="tocviewlink" data-pltdoc="x">&#31867;&#21512;&#32422;</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">13.1<tt>&nbsp;</tt></span><a href="#%28part._methods%29" class="tocsubseclink" data-pltdoc="x">&#26041;&#27861;</a></td></tr><tr><td><span class="tocsublinknumber">13.2<tt>&nbsp;</tt></span><a href="#%28part._initargs%29" class="tocsubseclink" data-pltdoc="x">&#21021;&#22987;&#21270;&#21442;&#25968;</a></td></tr><tr><td><span class="tocsublinknumber">13.3<tt>&nbsp;</tt></span><a href="#%28part._intnames%29" class="tocsubseclink" data-pltdoc="x">&#20869;&#37096;&#21644;&#22806;&#37096;&#21517;&#31216;</a></td></tr><tr><td><span class="tocsublinknumber">13.4<tt>&nbsp;</tt></span><a href="#%28part._.Interfaces%29" class="tocsubseclink" data-pltdoc="x">&#25509;&#21475;</a></td></tr><tr><td><span class="tocsublinknumber">13.5<tt>&nbsp;</tt></span><a href="#%28part._inner%29" class="tocsubseclink" data-pltdoc="x">Final&#12289;Augment&#21644;Inner</a></td></tr><tr><td><span class="tocsublinknumber">13.6<tt>&nbsp;</tt></span><a href="#%28part._extnames%29" class="tocsubseclink" data-pltdoc="x">&#25511;&#21046;&#22806;&#37096;&#21517;&#31216;&#30340;&#33539;&#22260;</a></td></tr><tr><td><span class="tocsublinknumber">13.7<tt>&nbsp;</tt></span><a href="#%28part._.Mixins%29" class="tocsubseclink" data-pltdoc="x">&#28151;&#21512;</a></td></tr><tr><td><span class="tocsublinknumber">13.7.1<tt>&nbsp;</tt></span><a href="#%28part._.Mixins-and-.Interfaces%29" class="tocsubseclink" data-pltdoc="x">&#28151;&#21512;&#21644;&#25509;&#21475;</a></td></tr><tr><td><span class="tocsublinknumber">13.7.2<tt>&nbsp;</tt></span><a href="#%28part._.The-mixin-.Form%29" class="tocsubseclink" data-pltdoc="x"><span class="RktSym"><span class="badlink"><span class="RktValLink">mixin</span></span></span>&#34920;</a></td></tr><tr><td><span class="tocsublinknumber">13.7.3<tt>&nbsp;</tt></span><a href="#%28part._parammixins%29" class="tocsubseclink" data-pltdoc="x">&#21442;&#25968;&#21270;&#30340;&#28151;&#21512;</a></td></tr><tr><td><span class="tocsublinknumber">13.8<tt>&nbsp;</tt></span><a href="#%28part._.Traits%29" class="tocsubseclink" data-pltdoc="x">&#29305;&#24449;</a></td></tr><tr><td><span class="tocsublinknumber">13.8.1<tt>&nbsp;</tt></span><a href="#%28part._.Traits-as-.Sets-of-.Mixins%29" class="tocsubseclink" data-pltdoc="x">&#29305;&#24449;&#20316;&#20026;&#28151;&#21512;&#38598;</a></td></tr><tr><td><span class="tocsublinknumber">13.8.2<tt>&nbsp;</tt></span><a href="#%28part._.Inherit-and-.Super-in-.Traits%29" class="tocsubseclink" data-pltdoc="x">&#29305;&#24449;&#30340;&#32487;&#25215;&#19982;&#22522;&#31867;</a></td></tr><tr><td><span class="tocsublinknumber">13.8.3<tt>&nbsp;</tt></span><a href="#%28part._.The-trait-.Form%29" class="tocsubseclink" data-pltdoc="x"><span class="RktSym"><span class="badlink"><span class="RktValLink">trait</span></span></span>&#34920;</a></td></tr><tr><td><span class="tocsublinknumber">13.9<tt>&nbsp;</tt></span><a href="#%28part._.Class-.Contracts%29" class="tocsubseclink" data-pltdoc="x">&#31867;&#21512;&#32422;</a></td></tr><tr><td><span class="tocsublinknumber">13.9.1<tt>&nbsp;</tt></span><a href="#%28part._.External-.Class-.Contracts%29" class="tocsubseclink" data-pltdoc="x">&#22806;&#37096;&#31867;&#21512;&#32422;</a></td></tr><tr><td><span class="tocsublinknumber">13.9.2<tt>&nbsp;</tt></span><a href="#%28part._.Internal-.Class-.Contracts%29" class="tocsubseclink" data-pltdoc="x">&#20869;&#37096;&#31867;&#21512;&#32422;</a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><div class="nosearchform"></div>&nbsp;&nbsp;</span><span class="navright">&nbsp;&nbsp;<a href="match.html" title="backward to &quot;12 模式匹配&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;Racket指南&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="units.html" title="forward to &quot;14 单元（组件）&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div><h3>13<tt>&nbsp;</tt><a name="(part._classes)"></a>&#31867;&#21644;&#23545;&#35937;</h3><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>&#26412;&#31456;&#22522;&#20110;&#19968;&#31687;&#35770;&#25991;[<a href="doc-bibliography.html#%28cite._.Flatt06%29" data-pltdoc="x">Flatt06</a>]&#12290;</p></blockquote></blockquote></blockquote><p>&#19968;&#20010;<span class="RktSym">&#31867;&#65288;class&#65289;</span>&#34920;&#36798;&#24335;&#34920;&#31034;&#19968;&#31867;&#20540;&#65292;&#23601;&#20687;&#19968;&#20010;<span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span>&#34920;&#36798;&#24335;&#19968;&#26679;&#65306;</p><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktVar">superclass-expr</span><span class="hspace">&nbsp;</span><span class="RktVar">decl-or-expr</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></blockquote></blockquote><p><span class="RktVar">superclass-expr</span>&#30830;&#23450;&#20026;&#26032;&#31867;&#30340;&#22522;&#31867;&#12290;&#27599;&#20010;<span class="RktVar">decl-or-expr</span>&#26082;&#26159;&#19968;&#20010;&#22768;&#26126;&#65292;&#20851;&#31995;&#21040;&#23545;&#26041;&#27861;&#12289;&#23383;&#27573;&#21644;&#21021;&#22987;&#21270;&#21442;&#25968;&#65292;&#20063;&#26159;&#19968;&#20010;&#34920;&#36798;&#24335;&#65292;&#27599;&#27425;&#27714;&#20540;&#23601;&#23454;&#20363;&#21270;&#31867;&#12290;&#25442;&#21477;&#35805;&#35828;&#65292;&#19982;&#26041;&#27861;&#20043;&#31867;&#30340;&#26500;&#36896;&#22120;&#19981;&#21516;&#65292;&#31867;&#20855;&#26377;&#19982;&#23383;&#27573;&#21644;&#26041;&#27861;&#22768;&#26126;&#20132;&#38169;&#30340;&#21021;&#22987;&#21270;&#34920;&#36798;&#24335;&#12290;</p><p>&#25353;&#29031;&#24815;&#20363;&#65292;&#31867;&#21517;&#20197;<span class="RktSym">%</span>&#32467;&#26463;&#12290;&#20869;&#32622;&#26681;&#31867;&#26159;<span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span>&#12290;&#19979;&#38754;&#30340;&#34920;&#36798;&#24335;&#29992;&#20844;&#20849;&#26041;&#27861;<span class="RktSym">get-size</span>&#12289;<span class="RktSym">grow</span>&#21644;<span class="RktSym">eat</span>&#21019;&#24314;&#19968;&#20010;&#31867;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">init</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="RktPn">)</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">&#21021;&#22987;&#21270;&#21442;&#25968;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">current-size</span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">&#23383;&#27573;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">&#22522;&#31867;&#21021;&#22987;&#21270;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-size</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">current-size</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">grow</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">set!</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">current-size</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="hspace">&nbsp;</span><span class="RktSym">current-size</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">other-fish</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">grow</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">other-fish</span><span class="hspace">&nbsp;</span><span class="RktSym">get-size</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#24403;&#36890;&#36807;<span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span>&#34920;&#23454;&#20363;&#21270;&#31867;&#26102;&#65292;<span class="RktSym">size</span>&#30340;&#21021;&#22987;&#21270;&#21442;&#25968;&#24517;&#39035;&#36890;&#36807;&#19968;&#20010;&#21629;&#21517;&#21442;&#25968;&#25552;&#20379;&#65306;</p><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">init</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktVal">10</span><span class="RktPn">]</span><span class="RktPn">)</span></p></blockquote><p>&#24403;&#28982;&#65292;&#25105;&#20204;&#36824;&#21487;&#20197;&#21629;&#21517;&#31867;&#21450;&#20854;&#23454;&#20363;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">init</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">charlie</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktVal">10</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#22312;<span class="RktSym">fish%</span>&#30340;&#23450;&#20041;&#20013;&#65292;<span class="RktSym">current-size</span>&#26159;&#19968;&#20010;&#20197;<span class="RktSym">size</span>&#20540;&#21021;&#22987;&#21270;&#21442;&#25968;&#24320;&#22836;&#30340;&#31169;&#26377;&#23383;&#27573;&#12290;&#20687;<span class="RktSym">size</span>&#36825;&#26679;&#30340;&#21021;&#22987;&#21270;&#21442;&#25968;&#21482;&#26377;&#22312;&#31867;&#23454;&#20363;&#21270;&#26102;&#25165;&#21487;&#29992;&#65292;&#22240;&#27492;&#19981;&#33021;&#30452;&#25509;&#20174;&#26041;&#27861;&#24341;&#29992;&#23427;&#20204;&#12290;&#19982;&#27492;&#30456;&#21453;&#65292;<span class="RktSym">current-size</span>&#23383;&#27573;&#21487;&#29992;&#20110;&#26041;&#27861;&#12290;</p><p>&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span>&#20013;&#30340;<span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span>&#34920;&#36798;&#24335;&#35843;&#29992;&#22522;&#31867;&#30340;&#21021;&#22987;&#21270;&#12290;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#22522;&#31867;&#26159;<span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span>&#65292;&#23427;&#27809;&#26377;&#24102;&#21021;&#22987;&#21270;&#21442;&#25968;&#20063;&#27809;&#26377;&#25191;&#34892;&#20219;&#20309;&#24037;&#20316;&#65307;&#24517;&#39035;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span>&#65292;&#22240;&#20026;&#19968;&#20010;&#31867;&#24635;&#24517;&#39035;&#24635;&#26159;&#35843;&#29992;&#20854;&#22522;&#31867;&#30340;&#21021;&#22987;&#21270;&#12290;</p><p>&#21021;&#22987;&#21270;&#21442;&#25968;&#12289;&#23383;&#27573;&#22768;&#26126;&#21644;&#34920;&#36798;&#24335;&#22914;<span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span>&#21487;&#20197;&#20197;<span class="RktSym">&#31867;&#65288;class&#65289;</span>&#20013;&#30340;&#20219;&#20309;&#39034;&#24207;&#20986;&#29616;&#65292;&#24182;&#19988;&#23427;&#20204;&#21487;&#20197;&#19982;&#26041;&#27861;&#22768;&#26126;&#20132;&#32455;&#22312;&#19968;&#36215;&#12290;&#31867;&#20013;&#34920;&#36798;&#24335;&#30340;&#30456;&#23545;&#39034;&#24207;&#20915;&#23450;&#20102;&#23454;&#20363;&#21270;&#36807;&#31243;&#20013;&#30340;&#27714;&#20540;&#39034;&#24207;&#12290;&#20363;&#22914;&#65292;&#22914;&#26524;&#19968;&#20010;&#23383;&#27573;&#30340;&#21021;&#22987;&#20540;&#38656;&#35201;&#35843;&#29992;&#19968;&#20010;&#26041;&#27861;&#65292;&#23427;&#21482;&#26377;&#22312;&#22522;&#31867;&#21021;&#22987;&#21270;&#21518;&#25165;&#33021;&#24037;&#20316;&#65292;&#28982;&#21518;&#23383;&#27573;&#22768;&#26126;&#24517;&#39035;&#25918;&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span>&#35843;&#29992;&#21518;&#12290;&#20197;&#36825;&#31181;&#26041;&#24335;&#25490;&#24207;&#23383;&#27573;&#21644;&#21021;&#22987;&#21270;&#22768;&#26126;&#26377;&#21161;&#20110;&#35268;&#36991;&#19981;&#21487;&#36991;&#20813;&#30340;&#27714;&#20540;&#12290;&#26041;&#27861;&#22768;&#26126;&#30340;&#30456;&#23545;&#39034;&#24207;&#23545;&#27714;&#20540;&#27809;&#26377;&#24433;&#21709;&#65292;&#22240;&#20026;&#26041;&#27861;&#22312;&#31867;&#23454;&#20363;&#21270;&#20043;&#21069;&#34987;&#23436;&#20840;&#23450;&#20041;&#12290;</p><h4>13.1<tt>&nbsp;</tt><a name="(part._methods)"></a>&#26041;&#27861;</h4><p><span class="RktSym">fish%</span>&#20013;&#30340;&#19977;&#20010;<span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span>&#22768;&#26126;&#37117;&#24341;&#20837;&#20102;&#19968;&#31181;&#26032;&#26041;&#27861;&#12290;&#22768;&#26126;&#20351;&#29992;&#19982;Racket&#20989;&#25968;&#30456;&#21516;&#30340;&#35821;&#27861;&#65292;&#20294;&#26041;&#27861;&#19981;&#33021;&#20316;&#20026;&#29420;&#31435;&#20989;&#25968;&#35775;&#38382;&#12290;&#35843;&#29992;<span class="RktSym">fish%</span>&#23545;&#35937;&#30340;<span class="RktSym">grow</span>&#26041;&#27861;&#38656;&#35201;<span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span>&#34920;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">charlie</span><span class="hspace">&nbsp;</span><span class="RktSym">grow</span><span class="hspace">&nbsp;</span><span class="RktVal">6</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">charlie</span><span class="hspace">&nbsp;</span><span class="RktSym">get-size</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">16</span></p></td></tr></table></blockquote><p>&#22312;<span class="RktSym">fish%</span>&#20013;&#65292;&#33258;&#26041;&#27861;&#21487;&#20197;&#34987;&#20687;&#20989;&#25968;&#37027;&#26679;&#35843;&#29992;&#65292;&#22240;&#20026;&#26041;&#27861;&#21517;&#22312;&#20316;&#29992;&#22495;&#20013;&#12290;&#20363;&#22914;&#65292;<span class="RktSym">fish%</span>&#20013;&#30340;<span class="RktSym">eat</span>&#26041;&#27861;&#30452;&#25509;&#35843;&#29992;<span class="RktSym">grow</span>&#26041;&#27861;&#12290;&#22312;&#31867;&#20013;&#65292;&#35797;&#22270;&#20197;&#38500;&#26041;&#27861;&#35843;&#29992;&#20197;&#22806;&#30340;&#20219;&#20309;&#26041;&#24335;&#20351;&#29992;&#26041;&#27861;&#21517;&#20250;&#23548;&#33268;&#35821;&#27861;&#38169;&#35823;&#12290;</p><p>&#22312;&#26576;&#20123;&#24773;&#20917;&#19979;&#65292;&#19968;&#20010;&#31867;&#24517;&#39035;&#35843;&#29992;&#30001;&#22522;&#31867;&#25552;&#20379;&#20294;&#19981;&#33021;&#34987;&#37325;&#20889;&#30340;&#26041;&#27861;&#12290;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#31867;&#21487;&#20197;&#20351;&#29992;&#24102;<span class="RktSym"><span class="badlink"><span class="RktValLink">this</span></span></span>&#30340;<span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span>&#26469;&#35775;&#38382;&#35813;&#26041;&#27861;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">hungry-fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat-more</span><span class="hspace">&nbsp;</span><span class="RktSym">fish1</span><span class="hspace">&nbsp;</span><span class="RktSym">fish2</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">this</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">fish1</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">this</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">fish2</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p>&nbsp;</p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td></td></tr></table></td></tr></table></blockquote><p>&#21478;&#22806;&#65292;&#31867;&#21487;&#20197;&#22768;&#26126;&#19968;&#20010;&#26041;&#27861;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span>&#65288;&#32487;&#25215;&#65289;&#30340;&#23384;&#22312;&#65292;&#35813;&#26041;&#27861;&#23558;&#26041;&#27861;&#21517;&#24341;&#20837;&#21040;&#30452;&#25509;&#35843;&#29992;&#30340;&#20316;&#29992;&#22495;&#20013;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">hungry-fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat-more</span><span class="hspace">&nbsp;</span><span class="RktSym">fish1</span><span class="hspace">&nbsp;</span><span class="RktSym">fish2</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">fish1</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">fish2</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p>&nbsp;</p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td></td></tr></table></td></tr></table></blockquote><p>&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span>&#22768;&#26126;&#20013;&#65292;&#22914;&#26524;<span class="RktSym">fish%</span>&#27809;&#26377;&#25552;&#20379;&#19968;&#20010;<span class="RktSym">eat</span>&#26041;&#27861;&#65292;&#37027;&#20040;&#22312;&#23545; <span class="RktSym">hungry-fish%</span>&#31867;&#34920;&#30340;&#27714;&#20540;&#20013;&#20250;&#20986;&#29616;&#19968;&#20010;&#38169;&#35823;&#12290;&#19982;&#27492;&#30456;&#21453;&#65292;&#29992;<span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="stt"> </span><span class="RktSym"><span class="badlink"><span class="RktValLink">this</span></span></span><span class="stt"> </span><span class="RktSym">....</span><span class="RktPn">)</span>&#65292;&#30452;&#21040;<span class="RktSym">eat-more</span>&#26041;&#27861;&#34987;&#35843;&#21644;<span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span>&#34920;&#34987;&#27714;&#20540;&#21069;&#19981;&#20250;&#21457;&#20986;&#38169;&#35823;&#20449;&#21495;&#12290;&#22240;&#27492;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span>&#26159;&#39318;&#36873;&#12290;</p><p><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span>&#30340;&#21478;&#19968;&#20010;&#32570;&#28857;&#26159;&#23427;&#27604;<span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span>&#25928;&#29575;&#20302;&#12290;&#19968;&#20010;&#26041;&#27861;&#30340;&#35831;&#27714;&#36890;&#36807;<span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span>&#35843;&#29992;&#23547;&#25214;&#22312;&#36816;&#34892;&#26102;&#22312;&#30446;&#26631;&#23545;&#35937;&#30340;&#31867;&#30340;&#26041;&#27861;&#65292;&#20351;<span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span>&#31867;&#20284;&#20110;java&#26041;&#27861;&#35843;&#29992;&#25509;&#21475;&#12290;&#30456;&#21453;&#65292;&#22522;&#20110;<span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span>&#30340;&#26041;&#27861;&#35843;&#29992;&#20351;&#29992;&#19968;&#20010;&#31867;&#30340;&#26041;&#27861;&#34920;&#20013;&#30340;&#20559;&#31227;&#37327;&#65292;&#23427;&#22312;&#31867;&#21019;&#24314;&#26102;&#35745;&#31639;&#12290;</p><p>&#20026;&#20102;&#22312;&#20174;&#26041;&#27861;&#31867;&#20043;&#22806;&#35843;&#29992;&#26041;&#27861;&#26102;&#23454;&#29616;&#19982;&#32487;&#25215;&#26041;&#27861;&#35843;&#29992;&#31867;&#20284;&#30340;&#24615;&#33021;&#65292;&#31243;&#24207;&#21592;&#24517;&#39035;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">generic</span></span></span>&#65288;&#27867;&#22411;&#65289;&#34920;&#65292;&#23427;&#29983;&#25104;&#19968;&#20010;&#29305;&#23450;&#31867;&#21644;&#29305;&#23450;&#26041;&#27861;&#30340;<span style="font-style: italic">generic&#26041;&#27861;</span>&#65292;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">send-generic</span></span></span>&#35843;&#29992;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">get-fish-size</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">generic</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fish%</span><span class="hspace">&nbsp;</span><span class="RktSym">get-size</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p>&nbsp;</p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send-generic</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">charlie</span><span class="hspace">&nbsp;</span><span class="RktSym">get-fish-size</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">16</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send-generic</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">hungry-fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktVal">32</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">get-fish-size</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">32</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send-generic</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">get-fish-size</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">generic:get-size: target is not an instance of the generic's</span></p></td></tr><tr><td><p><span class="RktErr">class</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">target: (object)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">class name: fish%</span></p></td></tr></table></td></tr></table></blockquote><p>&#31895;&#30053;&#22320;&#35828;&#65292;&#34920;&#21333;&#23558;&#31867;&#21644;&#22806;&#37096;&#26041;&#27861;&#21517;&#36716;&#25442;&#20026;&#31867;&#26041;&#27861;&#34920;&#20013;&#30340;&#20301;&#32622;&#12290;&#22914;&#19978;&#19968;&#20010;&#20363;&#23376;&#25152;&#31034;&#65292;&#36890;&#36807;&#27867;&#22411;&#26041;&#27861;&#21457;&#36865;&#26816;&#26597;&#23427;&#30340;&#21442;&#25968;&#26159;&#27867;&#22411;&#31867;&#30340;&#19968;&#20010;&#23454;&#20363;&#12290;</p><p>&#26159;&#21542;&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span>&#20869;&#30452;&#25509;&#35843;&#29992;&#26041;&#27861;&#65292;&#36890;&#36807;&#27867;&#22411;&#26041;&#27861;&#65292;&#25110;&#36890;&#36807;<span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span>&#65292;&#26041;&#27861;&#20197;&#36890;&#24120;&#30340;&#26041;&#24335;&#37325;&#20889;&#24037;&#31243;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">picky-fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/override</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">grow</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">grow</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">*</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">3/4</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">daisy</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">picky-fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktVal">20</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p>&nbsp;</p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">daisy</span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">charlie</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">daisy</span><span class="hspace">&nbsp;</span><span class="RktSym">get-size</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">32</span></p></td></tr></table></td></tr></table></blockquote><p>&#22312;<span class="RktSym">picky-fish%</span>&#30340;<span class="RktSym">grow</span>&#26041;&#27861;&#26159;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">define/override</span></span></span>&#22768;&#26126;&#30340;&#65292;&#32780;&#19981;&#26159; <span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span>&#65292;&#22240;&#20026;<span class="RktSym">grow</span>&#26159;&#20316;&#20026;&#19968;&#20010;&#37325;&#20889;&#30340;&#30003;&#26126;&#30340;&#24847;&#20041;&#12290;&#22914;&#26524;<span class="RktSym">grow</span>&#24050;&#32463;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span>&#22768;&#26126;&#65292;&#37027;&#20040;&#22312;&#23545;&#31867;&#34920;&#36798;&#24335;&#27714;&#20540;&#26102;&#20250;&#21457;&#20986;&#19968;&#20010;&#38169;&#35823;&#65292;&#22240;&#20026;<span class="RktSym">fish%</span>&#24050;&#32463;&#25552;&#20379;&#20102;<span class="RktSym">grow</span>&#12290;</p><p>&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">define/override</span></span></span>&#20063;&#20801;&#35768;&#36890;&#36807;<span class="RktSym"><span class="badlink"><span class="RktValLink">super</span></span></span>&#35843;&#29992;&#35843;&#29992;&#37325;&#20889;&#30340;&#26041;&#27861;&#12290;&#20363;&#22914;&#65292;<span class="RktSym">grow</span>&#22312;<span class="RktSym">picky-fish%</span>&#23454;&#29616;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">super</span></span></span>&#20195;&#29702;&#32473;&#22522;&#31867;&#30340;&#23454;&#29616;&#12290;</p><h4>13.2<tt>&nbsp;</tt><a name="(part._initargs)"></a>&#21021;&#22987;&#21270;&#21442;&#25968;</h4><p>&#22240;&#20026;<span class="RktSym">picky-fish%</span>&#30003;&#26126;&#27809;&#26377;&#20219;&#20309;&#21021;&#22987;&#21270;&#21442;&#25968;&#65292;&#20219;&#20309;&#21021;&#22987;&#21270;&#20540;&#22312;<span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="stt"> </span><span class="RktSym">picky-fish%</span><span class="stt"> </span><span class="RktSym">....</span><span class="RktPn">)</span>&#37324;&#25552;&#20379;&#37117;&#34987;&#20256;&#36882;&#32473;&#22522;&#31867;&#30340;&#21021;&#22987;&#21270;&#65292;&#21363;&#20256;&#36882;&#32473;<span class="RktSym">fish%</span>&#12290;&#23376;&#31867;&#21487;&#20197;&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span>&#35843;&#29992;&#20854;&#22522;&#31867;&#26102;&#25552;&#20379;&#39069;&#22806;&#30340;&#21021;&#22987;&#21270;&#21442;&#25968;&#65292;&#36825;&#26679;&#30340;&#21021;&#22987;&#21270;&#21442;&#25968;&#20250;&#20248;&#20808;&#20110;&#21442;&#25968;&#25552;&#20379;&#32473;<span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span>&#12290;&#20363;&#22914;&#65292;&#19979;&#38754;&#30340;<span class="RktSym">size-10-fish%</span>&#31867;&#24635;&#26159;&#20135;&#29983;&#22823;&#23567;&#20026;10&#30340;&#40060;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size-10-fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktVal">10</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p>&nbsp;</p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size-10-fish%</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">get-size</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">10</span></p></td></tr></table></td></tr></table></blockquote><p>&#23601;<span class="RktSym">size-10-fish%</span>&#26469;&#35828;&#65292;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span>&#25552;&#20379;&#19968;&#20010;<span class="RktSym">size</span>&#21021;&#22987;&#21270;&#21442;&#25968;&#20250;&#23548;&#33268;&#21021;&#22987;&#21270;&#38169;&#35823;&#65307;&#22240;&#20026;&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span>&#37324;&#30340;<span class="RktSym">size</span>&#20248;&#20808;&#65292;<span class="RktSym">size</span>&#25552;&#20379;&#32473;<span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span>&#27809;&#26377;&#30446;&#26631;&#30003;&#26126;&#12290;</p><p>&#22914;&#26524;<span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span>&#34920;&#22768;&#26126;&#19968;&#20010;&#40664;&#35748;&#20540;&#65292;&#21017;&#21021;&#22987;&#21270;&#21442;&#25968;&#26159;&#21487;&#36873;&#30340;&#12290;&#20363;&#22914;&#65292;&#19979;&#38754;&#30340;<span class="RktSym">default-10-fish%</span>&#31867;&#25509;&#21463;&#19968;&#20010;<span class="RktSym">size</span>&#30340;&#21021;&#22987;&#21270;&#21442;&#25968;&#65292;&#20294;&#22914;&#26524;&#22312;&#23454;&#20363;&#37324;&#27809;&#26377;&#25552;&#20379;&#20540;&#37027;&#23427;&#30340;&#40664;&#35748;&#20540;&#26159;10&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">default-10-fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fish%</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">init</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktVal">10</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p>&nbsp;</p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">default-10-fish%</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">(object:default-10-fish% ...)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">default-10-fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktVal">20</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">(object:default-10-fish% ...)</span></p></td></tr></table></td></tr></table></blockquote><p>&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span>&#35843;&#29992;&#20256;&#36882;&#23427;&#33258;&#24049;&#30340;<span class="RktSym">size</span>&#20540;&#20316;&#20026;<span class="RktSym">size</span>&#21021;&#22987;&#21270;&#21021;&#22987;&#21270;&#21442;&#25968;&#20256;&#36882;&#32473;&#22522;&#31867;&#12290;</p><h4>13.3<tt>&nbsp;</tt><a name="(part._intnames)"></a>&#20869;&#37096;&#21644;&#22806;&#37096;&#21517;&#31216;</h4><p>&#22312;<span class="RktSym">default-10-fish%</span>&#20013;<span class="RktSym">size</span>&#30340;&#20004;&#20010;&#20351;&#29992;&#25581;&#31034;&#20102;&#31867;&#25104;&#21592;&#26631;&#35782;&#31526;&#30340;&#21452;&#37325;&#36523;&#20221;&#12290;&#24403;<span class="RktSym">size</span>&#26159;<span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span>&#25110;<span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span>&#20013;&#30340;&#19968;&#20010;&#25324;&#21495;&#23545;&#30340;&#31532;&#19968;&#26631;&#35782;&#31526;&#65292;<span class="RktSym">size</span>&#26159;&#19968;&#20010;<span style="font-style: italic">&#22806;&#37096;&#21517;&#31216;&#65288;external name&#65289;</span>&#65292;&#35937;&#24449;&#24615;&#22320;&#21305;&#37197;&#21040;&#31867;&#20013;&#30340;&#21021;&#22987;&#21270;&#21442;&#25968;&#12290;&#24403;<span class="RktSym">size</span>&#20316;&#20026;&#19968;&#20010;&#34920;&#36798;&#24335;&#20986;&#29616;&#22312;<span class="RktSym">default-10-fish%</span>&#20013;&#65292;<span class="RktSym">size</span>&#26159;&#19968;&#20010;<span style="font-style: italic">&#20869;&#37096;&#21517;&#31216;&#65288;internal name&#65289;</span>&#65292;&#23427;&#26159;&#35789;&#27861;&#20316;&#29992;&#22495;&#12290;&#31867;&#20284;&#22320;&#65292;&#23545;&#32487;&#25215;&#30340;<span class="RktSym">eat</span>&#26041;&#27861;&#30340;&#35843;&#29992;&#20351;&#29992;<span class="RktSym">eat</span>&#20316;&#20026;&#20869;&#37096;&#21517;&#31216;&#65292;&#32780;&#19968;&#20010;<span class="RktSym">eat</span>&#30340;<span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span>&#30340;&#20351;&#29992;&#20316;&#20026;&#19968;&#20010;&#22806;&#37096;&#21517;&#31216;&#12290;</p><p><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span>&#34920;&#30340;&#23436;&#25972;&#35821;&#27861;&#20801;&#35768;&#31243;&#24207;&#21592;&#20026;&#31867;&#25104;&#21592;&#25351;&#23450;&#19981;&#21516;&#30340;&#20869;&#37096;&#21644;&#22806;&#37096;&#21517;&#31216;&#12290;&#30001;&#20110;&#20869;&#37096;&#21517;&#31216;&#26159;&#26412;&#22320;&#30340;&#65292;&#22240;&#27492;&#21487;&#20197;&#37325;&#21629;&#21517;&#23427;&#20204;&#65292;&#20197;&#36991;&#20813;&#35206;&#30422;&#25110;&#20914;&#31361;&#12290;&#36825;&#26679;&#30340;&#25913;&#21517;&#19981;&#24635;&#26159;&#24517;&#35201;&#30340;&#65292;&#20294;&#37325;&#21629;&#21517;&#32570;&#20047;&#30340;&#35299;&#20915;&#26041;&#27861;&#21487;&#20197;&#26159;&#29305;&#21035;&#32321;&#29712;&#12290;</p><h4>13.4<tt>&nbsp;</tt><a name="(part._.Interfaces)"></a>&#25509;&#21475;</h4><p>&#25509;&#21475;&#23545;&#20110;&#26816;&#26597;&#19968;&#20010;&#23545;&#35937;&#25110;&#19968;&#20010;&#31867;&#23454;&#29616;&#19968;&#32452;&#20855;&#26377;&#29305;&#23450;&#65288;&#38544;&#21547;&#65289;&#34892;&#20026;&#30340;&#26041;&#27861;&#38750;&#24120;&#26377;&#29992;&#12290;&#25509;&#21475;&#30340;&#36825;&#31181;&#20351;&#29992;&#26377;&#24110;&#21161;&#30340;&#65292;&#21363;&#20351;&#27809;&#26377;&#38745;&#24577;&#31867;&#22411;&#31995;&#32479;&#65288;&#37027;&#26159;java&#26377;&#25509;&#21475;&#30340;&#20027;&#35201;&#21407;&#22240;&#65289;&#12290;</p><p>Racket&#20013;&#30340;&#25509;&#21475;&#36890;&#36807;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">interface</span></span></span>&#34920;&#21019;&#24314;&#65292;&#23427;&#21482;&#22768;&#26126;&#38656;&#35201;&#21435;&#23454;&#29616;&#30340;&#25509;&#21475;&#30340;&#26041;&#27861;&#21517;&#31216;&#12290;&#25509;&#21475;&#21487;&#20197;&#25193;&#23637;&#20854;&#23427;&#25509;&#21475;&#65292;&#36825;&#24847;&#21619;&#30528;&#25509;&#21475;&#30340;&#23454;&#29616;&#20250;&#33258;&#21160;&#23454;&#29616;&#25193;&#23637;&#25509;&#21475;&#12290;</p><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">interface</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktVar">superinterface-expr</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></blockquote></blockquote><p>&#20026;&#20102;&#22768;&#26126;&#19968;&#20010;&#23454;&#29616;&#19968;&#20010;&#25509;&#21475;&#30340;&#31867;&#65292;&#24517;&#39035;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">class*</span></span></span>&#34920;&#20195;&#26367;<span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span>&#65306;</p><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class*</span></span></span><span class="hspace">&nbsp;</span><span class="RktVar">superclass-expr</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktVar">interface-expr</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVar">decl-or-expr</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></blockquote></blockquote><p>&#20363;&#22914;&#65292;&#25105;&#20204;&#19981;&#24517;&#24378;&#21046;&#25152;&#26377;&#30340;<span class="RktSym">fish%</span>&#31867;&#37117;&#26159;&#28304;&#33258;&#20110;<span class="RktSym">fish%</span>&#65292;&#25105;&#20204;&#21487;&#20197;&#23450;&#20041;<span class="RktSym">fish-interface</span>&#24182;&#25913;&#21464;<span class="RktSym">fish%</span>&#31867;&#26469;&#22768;&#26126;&#23427;&#23454;&#29616;&#20102;<span class="RktSym">fish-interface</span>&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fish-interface</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">interface</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">get-size</span><span class="hspace">&nbsp;</span><span class="RktSym">grow</span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class*</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">fish-interface</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#22914;&#26524;<span class="RktSym">fish%</span>&#30340;&#23450;&#20041;&#19981;&#21253;&#25324;<span class="RktSym">get-size</span>&#12289;<span class="RktSym">grow</span>&#21644;<span class="RktSym">eat</span>&#26041;&#27861;&#65292;&#37027;&#20040;&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">class*</span></span></span>&#34920;&#27714;&#20540;&#26102;&#20250;&#20986;&#29616;&#38169;&#35823;&#65292;&#22240;&#20026;&#23454;&#29616;<span class="RktSym">fish-interface</span>&#25509;&#21475;&#38656;&#35201;&#36825;&#20123;&#26041;&#27861;&#12290;</p><p><span class="RktSym"><span class="badlink"><span class="RktValLink">is-a?</span></span></span>&#21028;&#26029;&#25509;&#21463;&#19968;&#20010;&#23545;&#35937;&#20316;&#20026;&#23427;&#30340;&#31532;&#19968;&#20010;&#21442;&#25968;&#65292;&#21516;&#26102;&#31867;&#25110;&#25509;&#21475;&#20316;&#20026;&#23427;&#30340;&#31532;&#20108;&#20010;&#21442;&#25968;&#12290;&#24403;&#32473;&#20102;&#19968;&#20010;&#31867;&#65292;&#26080;&#35770;&#23545;&#35937;&#26159;&#35813;&#31867;&#30340;&#23454;&#20363;&#25110;&#32773;&#27966;&#29983;&#31867;&#30340;&#23454;&#20363;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">is-a?</span></span></span>&#37117;&#25191;&#34892;&#26816;&#26597;&#12290;&#24403;&#32473;&#19968;&#20010;&#25509;&#21475;&#65292;&#26080;&#35770;&#23545;&#35937;&#30340;&#31867;&#26159;&#21542;&#23454;&#29616;&#25509;&#21475;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">is-a?</span></span></span>&#37117;&#25191;&#34892;&#26816;&#26597;&#12290;&#21478;&#22806;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">implementation?</span></span></span>&#21028;&#26029;&#26816;&#26597;&#32473;&#23450;&#31867;&#26159;&#21542;&#23454;&#29616;&#32473;&#23450;&#25509;&#21475;&#12290;</p><h4>13.5<tt>&nbsp;</tt><a name="(part._inner)"></a>Final&#12289;Augment&#21644;Inner</h4><p>&#22312;java&#20013;&#65292;&#19968;&#20010;<span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span>&#34920;&#30340;&#26041;&#27861;&#21487;&#20197;&#34987;&#25351;&#23450;&#20026;<span style="font-style: italic">&#26368;&#32456;&#30340;&#65288;final&#65289;</span>&#65292;&#36825;&#24847;&#21619;&#30528;&#19968;&#20010;&#23376;&#31867;&#19981;&#33021;&#37325;&#20889;&#26041;&#27861;&#12290;&#19968;&#20010;&#26368;&#32456;&#26041;&#27861;&#26159;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">public-final</span></span></span>&#25110;<span class="RktSym"><span class="badlink"><span class="RktValLink">override-final</span></span></span>&#30003;&#26126;&#65292;&#21462;&#20915;&#20110;&#22768;&#26126;&#26159;&#20026;&#19968;&#20010;&#26032;&#26041;&#27861;&#36824;&#26159;&#19968;&#20010;&#37325;&#20889;&#23454;&#29616;&#12290;</p><p>&#22312;&#20801;&#35768;&#19982;&#19981;&#20801;&#35768;&#20219;&#24847;&#23436;&#20840;&#37325;&#20889;&#30340;&#20004;&#20010;&#26497;&#31471;&#20043;&#38388;&#65292;&#31867;&#31995;&#32479;&#36824;&#25903;&#25345;Beta&#31867;&#22411;&#30340;<span style="font-style: italic">&#21487;&#25193;&#23637;&#65288;augmentable&#65289;</span>&#26041;&#27861;&#12290;&#19968;&#20010;&#24102;<span class="RktSym"><span class="badlink"><span class="RktValLink">pubment</span></span></span>&#22768;&#26126;&#30340;&#26041;&#27861;&#31867;&#20284;&#20110;<span class="RktSym"><span class="badlink"><span class="RktValLink">public</span></span></span>&#65292;&#20294;&#26041;&#27861;&#19981;&#33021;&#22312;&#23376;&#31867;&#20013;&#37325;&#20889;&#65307;&#23427;&#20165;&#20165;&#26159;&#21487;&#25193;&#20805;&#12290;&#19968;&#20010;<span class="RktSym"><span class="badlink"><span class="RktValLink">pubment</span></span></span>&#26041;&#27861;&#24517;&#39035;&#26174;&#24335;&#22320;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">inner</span></span></span>&#35843;&#29992;&#19968;&#20010;&#25193;&#23637;&#65288;&#22914;&#26524;&#26377;&#65289;&#65307;&#19968;&#20010;&#23376;&#31867;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">pubment</span></span></span>&#25193;&#23637;&#26041;&#27861;&#65292;&#32780;&#19981;&#26159;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">override</span></span></span>&#12290;</p><p>&#19968;&#33324;&#26469;&#35828;&#65292;&#19968;&#20010;&#26041;&#27861;&#21487;&#20197;&#22312;&#31867;&#27966;&#29983;&#30340;&#25193;&#23637;&#27169;&#24335;&#21644;&#37325;&#20889;&#27169;&#24335;&#20043;&#38388;&#36827;&#34892;&#20999;&#25442;&#12290;<span class="RktSym"><span class="badlink"><span class="RktValLink">augride</span></span></span>&#26041;&#27861;&#35814;&#36848;&#34920;&#26126;&#20102;&#19968;&#20010;&#25193;&#23637;&#65292;&#36825;&#37324;&#36825;&#20010;&#25193;&#23637;&#26412;&#36523;&#22312;&#23376;&#31867;&#20013;&#26159;&#21487;&#37325;&#20889;&#30340;&#30340;&#26041;&#27861;&#65288;&#34429;&#28982;&#36825;&#20010;&#22522;&#31867;&#30340;&#23454;&#29616;&#19981;&#33021;&#37325;&#20889;&#65289;&#12290;&#21516;&#26679;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">overment</span></span></span>&#37325;&#20889;&#19968;&#20010;&#26041;&#27861;&#24182;&#20351;&#24471;&#37325;&#20889;&#30340;&#23454;&#29616;&#21464;&#24471;&#21487;&#25193;&#23637;&#12290;</p><h4>13.6<tt>&nbsp;</tt><a name="(part._extnames)"></a>&#25511;&#21046;&#22806;&#37096;&#21517;&#31216;&#30340;&#33539;&#22260;</h4><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>java&#30340;&#35775;&#38382;&#20462;&#39280;&#31526;&#65288;&#22914;<a name="(idx._(gentag._2))"></a><span class="stt">&#21463;&#20445;&#25252;&#30340;&#65288;protected&#65289;</span>&#65289;&#25198;&#28436;&#30340;&#19968;&#20010;&#35282;&#33394;&#31867;&#20284;&#20110;<span class="RktSym"><span class="badlink"><span class="RktValLink">define-member-name</span></span></span>&#65292;&#20294;&#19981;&#20687;java&#65292;&#35775;&#38382;&#25511;&#21046;Racket&#30340;&#26426;&#21046;&#26159;&#22522;&#20110;&#35789;&#27861;&#33539;&#22260;&#65292;&#19981;&#33021;&#32487;&#25215;&#23618;&#27425;&#32467;&#26500;&#12290;</p></blockquote></blockquote></blockquote><p>&#27491;&#22914;<a href="#%28part._intnames%29" data-pltdoc="x">&#20869;&#37096;&#21644;&#22806;&#37096;&#21517;&#31216;</a>&#25152;&#25351;&#20986;&#30340;&#65292;&#31867;&#25104;&#21592;&#26082;&#26377;&#20869;&#37096;&#21517;&#31216;&#65292;&#20063;&#26377;&#22806;&#37096;&#21517;&#31216;&#12290;&#25104;&#21592;&#23450;&#20041;&#22312;&#26412;&#22320;&#32465;&#23450;&#20869;&#37096;&#21517;&#31216;&#65292;&#27492;&#32465;&#23450;&#21487;&#20197;&#22312;&#26412;&#22320;&#37325;&#21629;&#21517;&#12290;&#19982;&#27492;&#30456;&#21453;&#65292;&#22806;&#37096;&#21517;&#31216;&#40664;&#35748;&#24773;&#20917;&#19979;&#20855;&#26377;&#20840;&#23616;&#33539;&#22260;&#65292;&#25104;&#21592;&#23450;&#20041;&#19981;&#32465;&#23450;&#22806;&#37096;&#21517;&#31216;&#12290;&#30456;&#21453;&#65292;&#25104;&#21592;&#23450;&#20041;&#25351;&#30340;&#26159;&#22806;&#37096;&#21517;&#31216;&#30340;&#29616;&#26377;&#32465;&#23450;&#65292;&#20854;&#20013;&#25104;&#21592;&#21517;&#32465;&#23450;&#21040;<span style="font-style: italic">&#25104;&#21592;&#38190;&#65288;member key&#65289;</span>&#65307;&#19968;&#20010;&#31867;&#26368;&#32456;&#23558;&#25104;&#21592;&#38190;&#26144;&#23556;&#21040;&#26041;&#27861;&#12289;&#23383;&#27573;&#21644;&#21021;&#22987;&#21270;&#21442;&#25968;&#12290;</p><p>&#22238;&#22836;&#30475;<span class="RktSym">hungry-fish%</span>&#31867;&#65288;<span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span>&#65289;&#34920;&#36798;&#24335;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">hungry-fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fish%</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat-more</span><span class="hspace">&nbsp;</span><span class="RktSym">fish1</span><span class="hspace">&nbsp;</span><span class="RktSym">fish2</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">fish1</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">fish2</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#22312;&#27714;&#20540;&#36807;&#31243;&#20013;<span class="RktSym">hungry-fish%</span>&#31867;&#21644;<span class="RktSym">fish%</span>&#31867;&#25351;&#30456;&#21516;&#30340;<span class="RktSym">eat</span>&#30340;&#20840;&#23616;&#32465;&#23450;&#12290;&#22312;&#36816;&#34892;&#26102;&#65292;&#22312;<span class="RktSym">hungry-fish%</span>&#20013;&#35843;&#29992;<span class="RktSym">eat</span>&#26159;&#36890;&#36807;&#20849;&#20139;&#32465;&#23450;&#21040;<span class="RktSym">eat</span>&#30340;&#26041;&#27861;&#38190;&#21644;<span class="RktSym">fish%</span>&#20013;&#30340;<span class="RktSym">eat</span>&#26041;&#27861;&#30456;&#21305;&#37197;&#12290;</p><p>&#23545;&#22806;&#37096;&#21517;&#31216;&#30340;&#40664;&#35748;&#32465;&#23450;&#26159;&#20840;&#23616;&#30340;&#65292;&#20294;&#31243;&#24207;&#21592;&#21487;&#20197;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">define-member-name</span></span></span>&#34920;&#24341;&#20837;&#22806;&#37096;&#21517;&#31216;&#32465;&#23450;&#12290;</p><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define-member-name</span></span></span><span class="hspace">&nbsp;</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span><span class="RktVar">member-key-expr</span><span class="RktPn">)</span></td></tr></table></blockquote></blockquote><p>&#29305;&#21035;&#26159;&#65292;&#36890;&#36807;&#20351;&#29992;<span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">generate-member-key</span></span></span><span class="RktPn">)</span>&#20316;&#20026;<span class="RktSym">member-key-expr</span>&#65292;&#22806;&#37096;&#21517;&#31216;&#21487;&#20197;&#20026;&#19968;&#20010;&#29305;&#23450;&#30340;&#33539;&#22260;&#23616;&#37096;&#21270;&#65292;&#22240;&#20026;&#29983;&#25104;&#30340;&#25104;&#21592;&#38190;&#33539;&#22260;&#20043;&#22806;&#30340;&#35775;&#38382;&#12290;&#25442;&#21477;&#35805;&#35828;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">define-member-name</span></span></span>&#32473;&#22806;&#37096;&#21517;&#31216;&#19968;&#31181;&#31169;&#26377;&#21253;&#33539;&#22260;&#65292;&#20294;&#20174;&#21253;&#20013;&#27010;&#25324;&#20026;Racket&#20013;&#30340;&#20219;&#24847;&#32465;&#23450;&#33539;&#22260;&#12290;</p><p>&#20363;&#22914;&#65292;&#19979;&#38754;&#30340;<span class="RktSym">fish%</span>&#31867;&#21644;<span class="RktSym">pond%</span>&#31867;&#36890;&#36807;&#19968;&#20010;<span class="RktSym">get-depth</span>&#26041;&#27861;&#37197;&#21512;&#65292;&#21482;&#26377;&#36825;&#20010;&#37197;&#21512;&#31867;&#21487;&#20197;&#35775;&#38382;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define-values</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">fish%</span><span class="hspace">&nbsp;</span><span class="RktSym">pond%</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">&#20004;&#20010;&#30456;&#20114;&#36882;&#24402;&#31867;</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">let</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define-member-name</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">get-depth</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">generate-member-key</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fish%</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">....</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">my-depth</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">my-pond</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">dive</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">set!</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">my-depth</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">min</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">my-depth</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">my-pond</span><span class="hspace">&nbsp;</span><span class="RktSym">get-depth</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">pond%</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">....</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">current-depth</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-depth</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">current-depth</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">values</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fish%</span><span class="hspace">&nbsp;</span><span class="RktSym">pond%</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#22806;&#37096;&#21517;&#31216;&#22312;&#21517;&#31216;&#31354;&#38388;&#20013;&#65292;&#23558;&#23427;&#20204;&#19982;&#20854;&#23427;Racket&#21517;&#31216;&#20998;&#38548;&#24320;&#12290;&#36825;&#20010;&#21333;&#29420;&#30340;&#21629;&#21517;&#31354;&#38388;&#34987;&#38544;&#24335;&#22320;&#29992;&#20110;<span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span>&#20013;&#30340;&#26041;&#27861;&#21517;&#12289;&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span>&#20013;&#30340;&#21021;&#22987;&#21270;&#21442;&#25968;&#21517;&#31216;&#65292;&#25110;&#25104;&#21592;&#23450;&#20041;&#20013;&#30340;&#22806;&#37096;&#21517;&#31216;&#12290;&#29305;&#27530;&#34920; <span class="RktSym"><span class="badlink"><span class="RktValLink">member-name-key</span></span></span>&#25552;&#20379;&#23545;&#20219;&#24847;&#34920;&#36798;&#24335;&#20301;&#32622;&#22806;&#37096;&#21517;&#31216;&#30340;&#32465;&#23450;&#30340;&#35775;&#38382;&#65306;<span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">member-name-key</span></span></span><span class="stt"> </span><span class="RktSym">id</span><span class="RktPn">)</span>&#22312;&#24403;&#21069;&#33539;&#22260;&#20869;&#29983;&#25104;<span class="RktSym">id</span>&#30340;&#25104;&#21592;&#38190;&#32465;&#23450;&#12290;</p><p>&#25104;&#21592;&#38190;&#20540;&#20027;&#35201;&#29992;&#20110;<span class="RktSym"><span class="badlink"><span class="RktValLink">define-member-name</span></span></span>&#34920;&#12290;&#36890;&#24120;&#65292;<span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">member-name-key</span></span></span><span class="stt"> </span><span class="RktSym">id</span><span class="RktPn">)</span>&#25429;&#33719;<span class="RktSym">id</span>&#30340;&#26041;&#27861;&#38190;&#65292;&#20197;&#20415;&#23427;&#21487;&#20197;&#22312;&#19981;&#21516;&#30340;&#33539;&#22260;&#20869;&#20256;&#36882;&#21040;<span class="RktSym"><span class="badlink"><span class="RktValLink">define-member-name</span></span></span>&#30340;&#20351;&#29992;&#12290;&#36825;&#31181;&#33021;&#21147;&#35777;&#26126;&#25512;&#24191;&#28151;&#21512;&#26159;&#26377;&#29992;&#30340;&#65292;&#20316;&#20026;&#25509;&#19979;&#26469;&#30340;&#35752;&#35770;&#12290;</p><h4>13.7<tt>&nbsp;</tt><a name="(part._.Mixins)"></a>&#28151;&#21512;</h4><p>&#22240;&#20026;<span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span>&#65288;&#31867;&#65289;&#26159;&#19968;&#31181;&#34920;&#36798;&#34920;&#65292;&#32780;&#19981;&#26159;&#22914;&#21516;&#22312;Smalltalk&#21644;java&#37324;&#30340;&#19968;&#20010;&#39030;&#32423;&#30340;&#22768;&#26126;&#65292;&#19968;&#20010;<span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span>&#34920;&#21487;&#20197;&#23884;&#22871;&#22312;&#20219;&#20309;&#35789;&#27861;&#33539;&#22260;&#20869;&#65292;&#21253;&#25324;lambda&#65288;&#955;&#65289;&#12290;&#20854;&#32467;&#26524;&#26159;&#19968;&#20010;<a name="(tech._~e6~b7~b7~e5~90~88~ef~bc~88mixin~ef~bc~89)"></a><span style="font-style: italic">&#28151;&#21512;&#65288;mixin&#65289;</span>&#65292;&#21363;&#65292;&#19968;&#20010;&#31867;&#30340;&#25193;&#23637;&#65292;&#26159;&#30456;&#23545;&#20110;&#23427;&#30340;&#22522;&#31867;&#30340;&#21442;&#25968;&#21270;&#12290;</p><p>&#20363;&#22914;&#65292;&#25105;&#20204;&#21487;&#20197;&#21442;&#25968;&#21270;<span class="RktSym">picky-fish%</span>&#31867;&#26469;&#35206;&#30422;&#23427;&#30340;&#22522;&#31867;&#20174;&#32780;&#23450;&#20041;<span class="RktSym">picky-mixin</span>&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">picky-mixin</span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/override</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">grow</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">grow</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">*</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">3/4</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">picky-fish%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">picky-mixin</span><span class="hspace">&nbsp;</span><span class="RktSym">fish%</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>Smalltalk&#39118;&#26684;&#31867;&#21644;Racket&#31867;&#20043;&#38388;&#30340;&#35768;&#22810;&#23567;&#30340;&#24046;&#24322;&#26377;&#21161;&#20110;&#28151;&#21512;&#30340;&#26377;&#25928;&#21033;&#29992;&#12290;&#29305;&#21035;&#26159;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">define/override</span></span></span>&#30340;&#20351;&#29992;&#20351;&#24471;<span class="RktSym">picky-mixin</span>&#26399;&#26395;&#19968;&#20010;&#31867;&#24102;&#26377;&#19968;&#20010;<span class="RktSym">grow</span>&#26041;&#27861;&#26356;&#26126;&#30830;&#12290;&#22914;&#26524;<span class="RktSym">picky-mixin</span>&#24212;&#29992;&#20110;&#19968;&#20010;&#27809;&#26377;<span class="RktSym">grow</span>&#26041;&#27861;&#30340;&#31867;&#65292;&#19968;&#26086;&#24212;&#29992;<span class="RktSym">picky-mixin</span>&#21017;&#20250;&#21457;&#20986;&#19968;&#20010;&#38169;&#35823;&#30340;&#20449;&#24687;&#12290;</p><p>&#21516;&#26679;&#65292;&#24403;&#24212;&#29992;&#28151;&#21512;&#26102;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span>&#65288;&#32487;&#25215;&#65289;&#25191;&#34892;&#8220;&#26041;&#27861;&#23384;&#22312;&#65288;method existence&#65289;&#8221;&#30340;&#35201;&#27714;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">hungry-mixin</span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat-more</span><span class="hspace">&nbsp;</span><span class="RktSym">fish1</span><span class="hspace">&nbsp;</span><span class="RktSym">fish2</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">fish1</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">fish2</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>mixin&#30340;&#20248;&#21183;&#26159;&#65292;&#25105;&#20204;&#21487;&#20197;&#24456;&#23481;&#26131;&#22320;&#23558;&#23427;&#20204;&#32467;&#21512;&#36215;&#26469;&#20197;&#21019;&#24314;&#26032;&#30340;&#31867;&#65292;&#20854;&#20849;&#20139;&#30340;&#23454;&#29616;&#19981;&#36866;&#21512;&#19968;&#20010;&#32487;&#25215;&#23618;&#27425;&#8212;&#8212;&#27809;&#26377;&#22810;&#32487;&#25215;&#30456;&#20851;&#30340;&#27495;&#20041;&#12290;&#37197;&#22791;<span class="RktSym">picky-mixin</span>&#21644;<span class="RktSym">hungry-mixin</span>&#65292;&#20026;&#8220;hungry&#8221;&#21019;&#36896;&#20102;&#19968;&#20010;&#31867;&#65292;&#20294;&#8220;picky fish&#8221;&#26159;&#30452;&#25130;&#20102;&#24403;&#30340;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">picky-hungry-fish%</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">hungry-mixin</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">picky-mixin</span><span class="hspace">&nbsp;</span><span class="RktSym">fish%</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#20851;&#38190;&#35789;&#21021;&#22987;&#21270;&#21442;&#25968;&#30340;&#20351;&#29992;&#26159;&#28151;&#21512;&#30340;&#26131;&#20110;&#20351;&#29992;&#30340;&#37325;&#28857;&#12290;&#20363;&#22914;&#65292;<span class="RktSym">picky-mixin</span>&#21644;<span class="RktSym">hungry-mixin</span>&#21487;&#20197;&#36890;&#36807;&#21512;&#36866;&#30340;<span class="RktSym">eat</span>&#26041;&#27861;&#21644;<span class="RktSym">grow</span>&#26041;&#27861;&#22686;&#21152;&#20219;&#20309;&#31867;&#65292;&#22240;&#20026;&#23427;&#20204;&#22312;&#23427;&#20204;&#30340;<span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span>&#34920;&#36798;&#24335;&#37324;&#27809;&#26377;&#25351;&#23450;&#21021;&#22987;&#21270;&#21442;&#25968;&#20063;&#27809;&#26377;&#28155;&#21152;&#19996;&#35199;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">person%</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">init</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">name</span><span class="hspace">&nbsp;</span><span class="RktSym">age</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">....</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">food</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">grow</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">child%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">hungry-mixin</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">picky-mixin</span><span class="hspace">&nbsp;</span><span class="RktSym">person%</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">oliver</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">child%</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">name</span><span class="hspace">&nbsp;</span><span class="RktVal">"Oliver"</span><span class="RktPn">]</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">age</span><span class="hspace">&nbsp;</span><span class="RktVal">6</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#26368;&#21518;&#65292;&#23545;&#31867;&#25104;&#21592;&#30340;&#22806;&#37096;&#21517;&#31216;&#30340;&#20351;&#29992;&#65288;&#32780;&#19981;&#26159;&#35789;&#27861;&#20316;&#29992;&#22495;&#26631;&#35782;&#31526;&#65289;&#20351;&#24471;&#28151;&#21512;&#20351;&#29992;&#24456;&#26041;&#20415;&#12290;&#28155;&#21152;<span class="RktSym">picky-mixin</span>&#21040;<span class="RktSym">person%</span>&#36816;&#34892;&#65292;&#22240;&#20026;&#36825;&#20010;&#21517;&#23383;<span class="RktSym">eat</span>&#21644;<span class="RktSym">grow</span>&#21305;&#37197;&#65292;&#22312;<span class="RktSym">fish%</span>&#21644;<span class="RktSym">person%</span>&#37324;&#27809;&#26377;&#20219;&#20309;<span class="RktSym">eat</span>&#21644;<span class="RktSym">grow</span>&#30340;&#20248;&#20808;&#30003;&#26126;&#21487;&#20197;&#26159;&#21516;&#26679;&#30340;&#26041;&#27861;&#12290;&#24403;&#25104;&#21592;&#21517;&#31216;&#24847;&#22806;&#30896;&#25758;&#21518;&#65292;&#27492;&#29305;&#24615;&#26159;&#19968;&#20010;&#28508;&#22312;&#30340;&#32570;&#38519;&#65307;&#19968;&#20123;&#24847;&#22806;&#20914;&#31361;&#21487;&#20197;&#36890;&#36807;&#38480;&#21046;&#22806;&#37096;&#21517;&#31216;&#20316;&#29992;&#22495;&#26469;&#32416;&#27491;&#65292;&#23601;&#20687;&#22312;&#12298;<a href="#%28part._extnames%29" data-pltdoc="x">&#25511;&#21046;&#22806;&#37096;&#21517;&#31216;&#30340;&#33539;&#22260;</a>&#65288;Controlling the Scope of External Names&#65289;&#12299;&#25152;&#35752;&#35770;&#30340;&#37027;&#26679;&#12290;</p><h5>13.7.1<tt>&nbsp;</tt><a name="(part._.Mixins-and-.Interfaces)"></a>&#28151;&#21512;&#21644;&#25509;&#21475;</h5><p>&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">implementation?</span></span></span>&#65292;<span class="RktSym">picky-mixin</span>&#21487;&#20197;&#35201;&#27714;&#20854;&#22522;&#31867;&#23454;&#29616;<span class="RktSym">grower-interface</span>&#65292;&#36825;&#21487;&#20197;&#26159;&#30001;<span class="RktSym">fish%</span>&#21644;<span class="RktSym">person%</span>&#23454;&#29616;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">grower-interface</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">interface</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">grow</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">picky-mixin</span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">unless</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">implementation?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="hspace">&nbsp;</span><span class="RktSym">grower-interface</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">error</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">"picky-mixin: not a grower-interface class"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#21478;&#19968;&#20010;&#20351;&#29992;&#24102;&#28151;&#21512;&#30340;&#25509;&#21475;&#26159;&#26631;&#35760;&#31867;&#36890;&#36807;&#28151;&#21512;&#20135;&#29983;&#65292;&#22240;&#27492;&#65292;&#28151;&#21512;&#23454;&#20363;&#21487;&#20197;&#34987;&#35782;&#21035;&#12290;&#25442;&#21477;&#35805;&#35828;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">is-a?</span></span></span>&#19981;&#33021;&#22312;&#19968;&#20010;&#28151;&#21512;&#19978;&#20307;&#29616;&#20026;&#19968;&#20010;&#20989;&#25968;&#36816;&#34892;&#65292;&#20294;&#23427;&#21487;&#20197;&#35782;&#21035;&#20026;&#19968;&#20010;&#25509;&#21475;&#65288;&#26377;&#28857;&#20687;&#19968;&#20010;<span style="font-style: italic">&#29305;&#23450;&#30340;&#25509;&#21475;</span>&#65289;&#65292;&#23427;&#24635;&#26159;&#34987;&#28151;&#21512;&#25152;&#23454;&#29616;&#12290;&#20363;&#22914;&#65292;&#36890;&#36807;<span class="RktSym">picky-mixin</span>&#29983;&#25104;&#30340;&#31867;&#21487;&#20197;&#34987;<span class="RktSym">picky-interface</span>&#25152;&#26631;&#35760;&#65292;&#20351;&#26159;<span class="RktSym">is-picky?</span>&#21435;&#21028;&#23450;:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">picky-interface</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">interface</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">picky-mixin</span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">unless</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">implementation?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="hspace">&nbsp;</span><span class="RktSym">grower-interface</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">error</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">"picky-mixin: not a grower-interface class"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class*</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">picky-interface</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">is-picky?</span><span class="hspace">&nbsp;</span><span class="RktSym">o</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">is-a?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">o</span><span class="hspace">&nbsp;</span><span class="RktSym">picky-interface</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><h5>13.7.2<tt>&nbsp;</tt><a name="(part._.The-mixin-.Form)"></a><span class="RktSym"><span class="badlink"><span class="RktValLink">mixin</span></span></span>&#34920;</h5><p>&#20026;&#25191;&#34892;&#28151;&#21512;&#32780;&#32534;&#32386;<span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span>&#21152;<span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span>&#27169;&#24335;&#65292;&#21253;&#25324;&#23545;&#28151;&#21512;&#30340;&#23450;&#20041;&#22495;&#21644;&#20540;&#22495;&#25509;&#21475;&#30340;&#20351;&#29992;&#65292;&#31867;&#31995;&#32479;&#25552;&#20379;&#20102;&#19968;&#20010;<span class="RktSym"><span class="badlink"><span class="RktValLink">mixin</span></span></span>&#23439;&#65306;</p><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">mixin</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktVar">interface-expr</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktVar">interface-expr</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">decl-or-expr</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></td></tr></table></blockquote></blockquote><p><span class="RktSym">interface-expr</span>&#30340;&#31532;&#19968;&#20010;&#38598;&#21512;&#30830;&#23450;&#28151;&#21512;&#30340;&#23450;&#20041;&#22495;&#65292;&#31532;&#20108;&#20010;&#38598;&#21512;&#30830;&#23450;&#20540;&#22495;&#12290;&#23601;&#26159;&#35828;&#65292;&#25193;&#24352;&#26159;&#19968;&#20010;&#20989;&#25968;&#65292;&#23427;&#27979;&#35797;&#26159;&#21542;&#19968;&#20010;&#32473;&#23450;&#30340;&#22522;&#31867;&#23454;&#29616;<span class="RktSym">interface-expr</span>&#30340;&#31532;&#19968;&#20010;&#24207;&#21015;&#65292;&#24182;&#20135;&#29983;&#19968;&#20010;&#31867;&#23454;&#29616;<span class="RktSym">interface-expr</span>&#30340;&#31532;&#20108;&#20010;&#24207;&#21015;&#12290;&#20854;&#23427;&#35201;&#27714;&#65292;&#22914;&#22312;&#22522;&#31867;&#30340;&#32487;&#25215;&#26041;&#27861;&#30340;&#23384;&#22312;&#65292;&#28982;&#21518;&#26816;&#26597;<span class="RktSym"><span class="badlink"><span class="RktValLink">mixin</span></span></span>&#34920;&#30340;<span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span>&#25193;&#23637;&#12290;&#20363;&#22914;:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">choosy-interface</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">interface</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">choose?</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">hungry-interface</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">interface</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">choosy-eater-mixin</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">mixin</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">choosy-interface</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">hungry-interface</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">choose?</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cond</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">choose?</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">printf</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">"chomp chomp chomp on ~a.\n"</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym"><span class="badlink"><span class="RktValLink">else</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">printf</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">"I'm not crazy about ~a.\n"</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">herring-lover%</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class*</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">choosy-interface</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">choose?</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">regexp-match</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">#px"^herring"</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">herring-eater%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">choosy-eater-mixin</span><span class="hspace">&nbsp;</span><span class="RktSym">herring-lover%</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">eater</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">herring-eater%</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">eater</span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktVal">"elderberry"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktOut">I'm not crazy about elderberry.</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">eater</span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktVal">"herring"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktOut">chomp chomp chomp on herring.</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">eater</span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktVal">"herring ice cream"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktOut">chomp chomp chomp on herring ice cream.</span></p></td></tr></table></blockquote><p>&#28151;&#21512;&#19981;&#20165;&#35206;&#30422;&#26041;&#27861;&#65292;&#24182;&#24341;&#20837;&#20844;&#20849;&#26041;&#27861;&#65292;&#23427;&#20204;&#20063;&#21487;&#20197;&#25193;&#23637;&#26041;&#27861;&#65292;&#24341;&#20837;&#25193;&#23637;&#30340;&#26041;&#27861;&#65292;&#28155;&#21152;&#19968;&#20010;&#21487;&#37325;&#20889;&#30340;&#25193;&#23637;&#65292;&#24182;&#28155;&#21152;&#19968;&#20010;&#21487;&#25193;&#23637;&#30340;&#35206;&#30422;&#8212;&#8212;&#25152;&#26377;&#36825;&#20123;&#20107;&#19968;&#20010;&#31867;&#37117;&#33021;&#23436;&#25104;&#65288;&#21442;&#35265;<a href="#%28part._inner%29" data-pltdoc="x">Final&#12289;Augment&#21644;Inner</a>&#37096;&#20998;&#65289;&#12290;</p><h5>13.7.3<tt>&nbsp;</tt><a name="(part._parammixins)"></a>&#21442;&#25968;&#21270;&#30340;&#28151;&#21512;</h5><p>&#27491;&#22914;&#22312;<a href="#%28part._extnames%29" data-pltdoc="x">&#25511;&#21046;&#22806;&#37096;&#21517;&#31216;&#30340;&#33539;&#22260;</a>&#20013;&#25351;&#20986;&#30340;&#65292;&#22806;&#37096;&#21517;&#31216;&#21487;&#20197;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">define-member-name</span></span></span>&#32465;&#23450;&#12290;&#36825;&#20010;&#24037;&#20855;&#20801;&#35768;&#19968;&#20010;&#28151;&#21512;&#29992;&#23450;&#20041;&#25110;&#20351;&#29992;&#30340;&#26041;&#27861;&#27010;&#25324;&#12290;&#20363;&#22914;&#65292;&#25105;&#20204;&#21487;&#20197;&#36890;&#36807;&#23545;<span class="RktSym">eat</span>&#30340;&#22806;&#37096;&#25104;&#21592;&#38190;&#30340;&#20351;&#29992;&#21442;&#25968;&#21270;<span class="RktSym">hungry-mixin</span>&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">make-hungry-mixin</span><span class="hspace">&nbsp;</span><span class="RktSym">eat-method-key</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define-member-name</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">eat-method-key</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">mixin</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat-more</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#33719;&#24471;&#19968;&#20010;&#29305;&#23450;&#30340;hungry-mixin&#65292;&#25105;&#20204;&#24517;&#39035;&#24212;&#29992;&#36825;&#20010;&#20989;&#25968;&#21040;&#19968;&#20010;&#25104;&#21592;&#38190;&#65292;&#23427;&#25351;&#21521;&#19968;&#20010;&#36866;&#24403;&#30340;<span class="RktSym">eat</span>&#26041;&#27861;&#65292;&#25105;&#20204;&#21487;&#20197;&#33719;&#24471; <span class="RktSym"><span class="badlink"><span class="RktValLink">member-name-key</span></span></span>&#30340;&#20351;&#29992;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym">make-hungry-mixin</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">member-name-key</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">yum</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#20197;&#19978;&#65292;&#25105;&#20204;&#24212;&#29992;<span class="RktSym">hungry-mixin</span>&#32473;&#19968;&#20010;&#21311;&#21517;&#31867;&#65292;&#23427;&#25552;&#20379;<span class="RktSym">eat</span>&#65292;&#20294;&#25105;&#20204;&#20063;&#21487;&#20197;&#25226;&#23427;&#21644;&#19968;&#20010;&#25552;&#20379;<span class="RktSym">chomp</span>&#30340;&#31867;&#32452;&#21512;&#65292;&#30456;&#21453;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym">make-hungry-mixin</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">member-name-key</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">chomp</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">chomp</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">yum</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><h4>13.8<tt>&nbsp;</tt><a name="(part._.Traits)"></a>&#29305;&#24449;</h4><p>&#19968;&#20010;<span style="font-style: italic">&#29305;&#24449;&#65288;trait&#65289;</span>&#31867;&#20284;&#20110;&#19968;&#20010;mixin&#65292;&#23427;&#23553;&#35013;&#20102;&#19968;&#32452;&#26041;&#27861;&#28155;&#21152;&#21040;&#19968;&#20010;&#31867;&#37324;&#12290;&#19968;&#20010;&#29305;&#24449;&#19981;&#21516;&#20110;&#19968;&#20010;mixin&#65292;&#23427;&#33258;&#24049;&#30340;&#26041;&#27861;&#26159;&#21487;&#20197;&#29992;&#29305;&#24449;&#36816;&#31639;&#31526;&#25805;&#25511;&#30340;&#65292;&#27604;&#22914;<span class="RktSym"><span class="badlink"><span class="RktValLink">trait-sum</span></span></span>&#65288;&#21512;&#24182;&#36825;&#20004;&#20010;&#29305;&#24449;&#30340;&#26041;&#27861;&#65289;&#12289;<span class="RktSym"><span class="badlink"><span class="RktValLink">trait-exclude</span></span></span>&#65288;&#20174;&#19968;&#20010;&#29305;&#24449;&#20013;&#31227;&#38500;&#26041;&#27861;&#65289;&#20197;&#21450;<span class="RktSym"><span class="badlink"><span class="RktValLink">trait-alias</span></span></span>&#65288;&#28155;&#21152;&#19968;&#20010;&#24102;&#26377;&#26032;&#21517;&#23383;&#30340;&#26041;&#27861;&#30340;&#25335;&#36125;&#65307;&#23427;&#19981;&#37325;&#23450;&#21521;&#21040;&#23545;&#20219;&#20309;&#26087;&#21517;&#23383;&#30340;&#35843;&#29992;&#65289;&#12290;</p><p>&#28151;&#21512;&#21644;&#29305;&#24449;&#20043;&#38388;&#30340;&#23454;&#38469;&#24046;&#21035;&#26159;&#20004;&#20010;&#29305;&#24449;&#21487;&#20197;&#32452;&#21512;&#65292;&#21363;&#20351;&#23427;&#20204;&#21253;&#25324;&#20102;&#20849;&#26377;&#30340;&#26041;&#27861;&#65292;&#32780;&#19988;&#21363;&#20351;&#20004;&#32773;&#30340;&#26041;&#27861;&#37117;&#21487;&#20197;&#21512;&#29702;&#22320;&#35206;&#30422;&#20854;&#23427;&#26041;&#27861;&#12290;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#31243;&#24207;&#21592;&#24517;&#39035;&#26126;&#30830;&#22320;&#35299;&#20915;&#20914;&#31361;&#65292;&#36890;&#24120;&#36890;&#36807;&#28151;&#28102;&#26041;&#27861;&#65292;&#25490;&#38500;&#26041;&#27861;&#65292;&#20197;&#21450;&#21512;&#24182;&#20351;&#29992;&#21035;&#21517;&#30340;&#26032;&#29305;&#24615;&#12290;</p><p>&#20551;&#35774;&#25105;&#20204;&#30340;<span class="RktSym">fish%</span>&#31243;&#24207;&#21592;&#24819;&#35201;&#23450;&#20041;&#20004;&#20010;&#31867;&#25193;&#23637;&#65292;<span class="RktSym">spots</span>&#21644;<span class="RktSym">stripes</span>&#65292;&#27599;&#20010;&#37117;&#21253;&#21547;<span class="RktSym">get-color</span>&#26041;&#27861;&#12290;fish&#30340;spot&#19981;&#24212;&#35813;&#35206;&#30422;&#30340;stripe&#65292;&#21453;&#20043;&#20134;&#28982;&#65307;&#30456;&#21453;&#65292;&#19968;&#20010;<span class="RktSym">spots+stripes-fish%</span>&#24212;&#32467;&#21512;&#20004;&#31181;&#39068;&#33394;&#65292;&#36825;&#26159;&#19981;&#21487;&#33021;&#30340;&#22914;&#26524;<span class="RktSym">spots</span>&#21644;<span class="RktSym">stripes</span>&#26159;&#26222;&#36890;&#28151;&#21512;&#23454;&#29616;&#12290;&#28982;&#32780;&#65292;&#22914;&#26524;spots&#21644;stripes&#20316;&#20026;&#29305;&#24449;&#26469;&#23454;&#29616;&#65292;&#23427;&#20204;&#21487;&#20197;&#32452;&#21512;&#22312;&#19968;&#36215;&#12290;&#39318;&#20808;&#65292;&#25105;&#20204;&#22312;&#27599;&#20010;&#29305;&#24449;&#20013;&#32473;<span class="RktSym">get-color</span>&#36215;&#19968;&#20010;&#21035;&#21517;&#20026;&#19968;&#20010;&#19981;&#20914;&#31361;&#30340;&#21517;&#31216;&#12290;&#31532;&#20108;&#65292;<span class="RktSym">get-color</span>&#26041;&#27861;&#20174;&#20004;&#32773;&#20013;&#31227;&#38500;&#65292;&#21482;&#26377;&#21035;&#21517;&#30340;&#29305;&#24449;&#34987;&#21512;&#24182;&#12290;&#26368;&#21518;&#65292;&#26032;&#29305;&#24449;&#29992;&#20110;&#21019;&#24314;&#19968;&#20010;&#31867;&#65292;&#23427;&#22522;&#20110;&#36825;&#20004;&#20010;&#21035;&#21517;&#24341;&#20837;&#33258;&#24049;&#30340;<span class="RktSym">get-color</span>&#26041;&#27861;&#65292;&#29983;&#25104;&#25152;&#38656;&#30340;<span class="RktSym">spots+stripes</span>&#25193;&#23637;&#12290;</p><h5>13.8.1<tt>&nbsp;</tt><a name="(part._.Traits-as-.Sets-of-.Mixins)"></a>&#29305;&#24449;&#20316;&#20026;&#28151;&#21512;&#38598;</h5><p>&#22312;Racket&#37324;&#23454;&#29616;&#29305;&#24449;&#30340;&#19968;&#20010;&#33258;&#28982;&#30340;&#26041;&#27861;&#26159;&#22914;&#21516;&#19968;&#32452;&#28151;&#21512;&#65292;&#27599;&#20010;&#29305;&#24449;&#26041;&#27861;&#24102;&#19968;&#20010;mixin&#12290;&#20363;&#22914;&#65292;&#25105;&#20204;&#21487;&#20197;&#23581;&#35797;&#22914;&#19979;&#23450;&#20041;spots&#21644;stripes&#30340;&#29305;&#24449;&#65292;&#20351;&#29992;&#20851;&#32852;&#21015;&#34920;&#26469;&#34920;&#31034;&#38598;&#21512;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">spots-trait</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cons</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">get-color</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">%</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">'</span><span class="RktVal">black</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">stripes-trait</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cons</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">get-color</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">%</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">'</span><span class="RktVal">red</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#19968;&#20010;&#38598;&#21512;&#30340;&#34920;&#31034;&#65292;&#22914;&#19978;&#38754;&#25152;&#36848;&#65292;&#20801;&#35768;<span class="RktSym"><span class="badlink"><span class="RktValLink">trait-sum</span></span></span>&#21644;<span class="RktSym"><span class="badlink"><span class="RktValLink">trait-exclude</span></span></span>&#20570;&#20026;&#31616;&#21333;&#25805;&#20316;&#65307;&#19981;&#24184;&#30340;&#26159;&#65292;&#23427;&#19981;&#25903;&#25345;<span class="RktSym"><span class="badlink"><span class="RktValLink">trait-alias</span></span></span>&#36816;&#31639;&#31526;&#12290;&#34429;&#28982;&#19968;&#20010;&#28151;&#21512;&#21487;&#20197;&#22312;&#20851;&#32852;&#34920;&#37324;&#22797;&#21046;&#65292;&#28151;&#21512;&#26377;&#19968;&#20010;&#22266;&#23450;&#30340;&#26041;&#27861;&#21517;&#31216;&#65292;&#20363;&#22914;&#65292;<span class="RktSym">get-color</span>&#65292;&#32780;&#19988;&#28151;&#21512;&#19981;&#25903;&#25345;&#26041;&#27861;&#37325;&#21629;&#21517;&#25805;&#20316;&#12290;&#25903;&#25345;<span class="RktSym"><span class="badlink"><span class="RktValLink">trait-alias</span></span></span>&#65292;&#25105;&#20204;&#24517;&#39035;&#22312;&#25193;&#23637;&#26041;&#27861;&#21517;&#19978;&#21442;&#25968;&#21270;&#28151;&#21512;&#65292;&#21516;&#26679;&#22320;<span class="RktSym">eat</span>&#22312;&#21442;&#25968;&#21270;&#28151;&#21512;&#65288;<a href="#%28part._parammixins%29" data-pltdoc="x">&#21442;&#25968;&#21270;&#30340;&#28151;&#21512;</a>&#65289;&#20013;&#36827;&#34892;&#21442;&#25968;&#21270;&#12290;</p><p>&#20026;&#20102;&#25903;&#25345;<span class="RktSym"><span class="badlink"><span class="RktValLink">trait-alias</span></span></span>&#25805;&#20316;&#65292;<span class="RktSym">spots-trait</span>&#24212;&#34920;&#31034;&#20026;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">spots-trait</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cons</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">member-name-key</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">get-color</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color-key</span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define-member-name</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">get-color</span><span class="hspace">&nbsp;</span><span class="RktSym">get-color-key</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">black</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#24403;<span class="RktSym">spots-trait</span>&#20013;&#30340;<span class="RktSym">get-color</span>&#26041;&#27861;&#26159;&#32473;<span class="RktSym">get-trait-color</span>&#30340;&#21035;&#21517;&#24182;&#19988;<span class="RktSym">get-color</span>&#26041;&#27861;&#34987;&#21435;&#38500;&#65292;&#30001;&#27492;&#20135;&#29983;&#30340;&#29305;&#24615;&#22914;&#19979;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cons</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">member-name-key</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">get-trait-color</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color-key</span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define-member-name</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">get-color</span><span class="hspace">&nbsp;</span><span class="RktSym">get-color-key</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">black</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#24212;&#29992;&#29305;&#24449;<span class="RktVar">T</span>&#21040;&#19968;&#20010;&#31867;<span class="RktVar">C</span>&#21644;&#33719;&#24471;&#19968;&#20010;&#27966;&#29983;&#31867;&#65292;&#25105;&#20204;&#29992;<span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">trait-&gt;mixin</span></span></span><span class="stt"> </span><span class="RktVar">T</span><span class="RktPn">)</span><span class="stt"> </span><span class="RktVar">C</span><span class="RktPn">)</span>&#12290;<span class="RktSym"><span class="badlink"><span class="RktValLink">trait-&gt;mixin</span></span></span>&#20989;&#25968;&#29992;&#32473;&#28151;&#21512;&#30340;&#26041;&#27861;&#21644;&#37096;&#20998;<span class="RktVar">C</span>&#25193;&#23637;&#30340;&#38190;&#25552;&#20379;&#27599;&#20010;<span class="RktVar">T</span>&#30340;&#28151;&#21512;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">trait-&gt;mixin</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">T</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">C</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">foldr</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">m</span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cdr</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">m</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">car</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">m</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">C</span><span class="hspace">&nbsp;</span><span class="RktSym">T</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#22240;&#27492;&#65292;&#24403;&#19978;&#36848;&#29305;&#24615;&#19982;&#20854;&#23427;&#29305;&#24615;&#32467;&#21512;&#65292;&#28982;&#21518;&#24212;&#29992;&#21040;&#31867;&#20013;&#26102;&#65292;<span class="RktSym">get-color</span>&#30340;&#20351;&#29992;&#23558;&#25104;&#20026;&#22806;&#37096;&#21517;&#31216;<span class="RktSym">get-trait-color</span>&#30340;&#24341;&#29992;&#12290;</p><h5>13.8.2<tt>&nbsp;</tt><a name="(part._.Inherit-and-.Super-in-.Traits)"></a>&#29305;&#24449;&#30340;&#32487;&#25215;&#19982;&#22522;&#31867;</h5><p>&#29305;&#24615;&#30340;&#36825;&#20010;&#31532;&#19968;&#20010;&#23454;&#29616;&#25903;&#25345;<span class="RktSym"><span class="badlink"><span class="RktValLink">trait-alias</span></span></span>&#65292;&#23427;&#25903;&#25345;&#19968;&#20010;&#35843;&#29992;&#33258;&#36523;&#30340;&#29305;&#24615;&#26041;&#27861;&#65292;&#20294;&#26159;&#23427;&#19981;&#25903;&#25345;&#35843;&#29992;&#24444;&#27492;&#30340;&#29305;&#24449;&#26041;&#27861;&#12290;&#29305;&#21035;&#26159;&#65292;&#20551;&#35774;&#19968;&#20010;spot-fish&#30340;&#24066;&#22330;&#20215;&#20540;&#21462;&#20915;&#20110;&#23427;&#30340;&#26001;&#28857;&#39068;&#33394;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">spots-trait</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cons</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">member-name-key</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">get-color</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cons</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">member-name-key</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">get-price</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-price</span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-price</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">....</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;<span class="RktSym">spots-trait</span>&#30340;&#23450;&#20041;&#22833;&#36133;&#65292;&#22240;&#20026;<span class="RktSym">get-color</span>&#26159;&#19981;&#22312;<span class="RktSym">get-price</span>&#28151;&#21512;&#33539;&#22260;&#20043;&#20869;&#12290;&#20107;&#23454;&#19978;&#65292;&#24403;&#29305;&#24449;&#24212;&#29992;&#20110;&#19968;&#20010;&#31867;&#26102;&#20381;&#36182;&#20110;&#28151;&#21512;&#31243;&#24207;&#30340;&#39034;&#24207;&#65292;&#24403;<span class="RktSym">get-price</span>&#28151;&#21512;&#24212;&#29992;&#20110;&#31867;&#26102;<span class="RktSym">get-color</span>&#26041;&#27861;&#21487;&#33021;&#19981;&#21487;&#33719;&#24471;&#12290;&#22240;&#27492;&#28155;&#21152;&#19968;&#20010;<span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span><span class="stt"> </span><span class="RktSym">get-color</span><span class="RktPn">)</span>&#30003;&#26126;&#32473;<span class="RktSym">get-price</span>&#28151;&#21512;&#24182;&#19981;&#35299;&#20915;&#38382;&#39064;&#12290;</p><p>&#19968;&#31181;&#35299;&#20915;&#26041;&#26696;&#26159;&#35201;&#27714;&#22312;&#20687;<span class="RktSym">get-price</span>&#26041;&#27861;&#20013;&#20351;&#29992;<span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="stt"> </span><span class="RktSym"><span class="badlink"><span class="RktValLink">this</span></span></span><span class="stt"> </span><span class="RktSym">get-color</span><span class="RktPn">)</span>&#12290;&#36825;&#31181;&#26356;&#25913;&#26159;&#26377;&#25928;&#30340;&#65292;&#22240;&#20026;<span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span>&#24635;&#26159;&#24310;&#36831;&#26041;&#27861;&#26597;&#25214;&#65292;&#30452;&#21040;&#23545;&#26041;&#27861;&#30340;&#35843;&#29992;&#34987;&#27714;&#20540;&#12290;&#28982;&#32780;&#65292;&#24310;&#36831;&#26597;&#25214;&#27604;&#30452;&#25509;&#35843;&#29992;&#26356;&#20026;&#26114;&#36149;&#12290;&#26356;&#31967;&#31957;&#30340;&#26159;&#65292;&#23427;&#20063;&#24310;&#36831;&#26816;&#26597;<span class="RktSym">get-color</span>&#26041;&#27861;&#26159;&#21542;&#23384;&#22312;&#12290;</p><p>&#31532;&#20108;&#20010;&#65292;&#23454;&#38469;&#19978;&#65292;&#24182;&#19988;&#26377;&#25928;&#30340;&#35299;&#20915;&#26041;&#26696;&#26159;&#25913;&#21464;&#29305;&#24449;&#32534;&#30721;&#12290;&#20855;&#20307;&#26469;&#35828;&#65292;&#25105;&#20204;&#20195;&#34920;&#27599;&#20010;&#26041;&#27861;&#20316;&#20026;&#19968;&#23545;&#28151;&#21512;&#65306;&#19968;&#20010;&#24341;&#20837;&#26041;&#27861;&#65292;&#21478;&#19968;&#20010;&#23454;&#29616;&#23427;&#12290;&#24403;&#19968;&#20010;&#29305;&#24449;&#24212;&#29992;&#20110;&#19968;&#20010;&#31867;&#65292;&#25152;&#26377;&#30340;&#24341;&#20837;&#26041;&#27861;&#28151;&#21512;&#39318;&#20808;&#34987;&#24212;&#29992;&#12290;&#28982;&#21518;&#23454;&#29616;&#26041;&#27861;&#28151;&#21512;&#21487;&#20197;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span>&#21435;&#30452;&#25509;&#35775;&#38382;&#20219;&#20309;&#24341;&#20837;&#30340;&#26041;&#27861;&#12290;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">spots-trait</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">local-member-name-key</span><span class="hspace">&nbsp;</span><span class="RktSym">get-color</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color</span><span class="hspace">&nbsp;</span><span class="RktSym">get-price</span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">void</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color</span><span class="hspace">&nbsp;</span><span class="RktSym">get-price</span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/override</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">black</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">local-member-name-key</span><span class="hspace">&nbsp;</span><span class="RktSym">get-price</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-price</span><span class="hspace">&nbsp;</span><span class="RktSym">get-color</span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-price</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">void</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color</span><span class="hspace">&nbsp;</span><span class="RktSym">get-price</span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">%</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">get-color</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/override</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-price</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">....</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#26377;&#20102;&#36825;&#20010;&#29305;&#24615;&#32534;&#30721;&#65292;  <span class="RktSym"><span class="badlink"><span class="RktValLink">trait-alias</span></span></span>&#28155;&#21152;&#19968;&#20010;&#24102;&#26032;&#21517;&#31216;&#30340;&#26032;&#26041;&#27861;&#65292;&#20294;&#23427;&#19981;&#20250;&#25913;&#21464;&#23545;&#26087;&#26041;&#27861;&#30340;&#20219;&#20309;&#24341;&#29992;&#12290;</p><h5>13.8.3<tt>&nbsp;</tt><a name="(part._.The-trait-.Form)"></a><span class="RktSym"><span class="badlink"><span class="RktValLink">trait</span></span></span>&#34920;</h5><p>&#36890;&#29992;&#29305;&#24615;&#27169;&#24335;&#26174;&#28982;&#23545;&#31243;&#24207;&#21592;&#30452;&#25509;&#20351;&#29992;&#26469;&#35828;&#22826;&#22797;&#26434;&#20102;&#65292;&#20294;&#24456;&#23481;&#26131;&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">trait</span></span></span>&#23439;&#20013;&#32534;&#35793;&#65306;</p><blockquote class="leftindent"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">trait</span></span></span><span class="hspace">&nbsp;</span><span class="RktVar">trait-clause</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></blockquote></blockquote><p>The <span class="RktSym">id</span>s in the optional <span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span> clause are available for direct
reference in the method <span class="RktSym">expr</span>s, and they must be supplied
either by other traits or the base class to which
the trait is ultimately applied.
&#22312;&#21487;&#36873;&#39033;&#30340;<span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span>&#65288;&#32487;&#25215;&#65289;&#20174;&#21477;&#20013;&#30340;<span class="RktSym">id</span>&#23545;<span class="RktSym">expr</span>&#26041;&#27861;&#20013;&#30340;&#30452;&#25509;&#24341;&#29992;&#26159;&#26377;&#25928;&#30340;&#65292;&#24182;&#19988;&#23427;&#20204;&#24517;&#39035;&#25552;&#20379;&#20854;&#23427;&#29305;&#24449;&#25110;&#32773;&#22522;&#31867;&#65292;&#20854;&#29305;&#24449;&#34987;&#26368;&#32456;&#24212;&#29992;&#12290;</p><p>&#20351;&#29992;&#36825;&#20010;&#34920;&#32467;&#21512;&#29305;&#24449;&#25805;&#20316;&#31526;&#65292;&#22914;<span class="RktSym"><span class="badlink"><span class="RktValLink">trait-sum</span></span></span>&#12289;<span class="RktSym"><span class="badlink"><span class="RktValLink">trait-exclude</span></span></span>&#12289;<span class="RktSym"><span class="badlink"><span class="RktValLink">trait-alias</span></span></span>&#21644;<span class="RktSym"><span class="badlink"><span class="RktValLink">trait-&gt;mixin</span></span></span>,&#25105;&#20204;&#21487;&#20197;&#23454;&#29616;<span class="RktSym">spots-trait</span>&#21644;<span class="RktSym">stripes-trait</span>&#20316;&#20026;&#25152;&#38656;&#12290;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">spots-trait</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">trait</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">black</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-price</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">...</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">...</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">stripes-trait</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">trait</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">red</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">spots+stripes-trait</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">trait-sum</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">trait-exclude</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">trait-alias</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">spots-trait</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">get-color</span><span class="hspace">&nbsp;</span><span class="RktSym">get-spots-color</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">get-color</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">trait-exclude</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">trait-alias</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">stripes-trait</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">get-color</span><span class="hspace">&nbsp;</span><span class="RktSym">get-stripes-color</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">get-color</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">trait</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">get-spots-color</span><span class="hspace">&nbsp;</span><span class="RktSym">get-stripes-color</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-color</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">....</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-spots-color</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-stripes-color</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">....</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><h4>13.9<tt>&nbsp;</tt><a name="(part._.Class-.Contracts)"></a>&#31867;&#21512;&#32422;</h4><p>&#30001;&#20110;&#31867;&#26159;&#20540;&#65292;&#23427;&#20204;&#21487;&#20197;&#36328;&#36234;&#21512;&#32422;&#36793;&#30028;&#65292;&#25105;&#20204;&#21487;&#33021;&#24076;&#26395;&#29992;&#21512;&#32422;&#20445;&#25252;&#32473;&#23450;&#31867;&#30340;&#19968;&#37096;&#20998;&#12290;&#20026;&#27492;&#65292;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">class/c</span></span></span>&#34920;&#12290;<span class="RktSym"><span class="badlink"><span class="RktValLink">class/c</span></span></span>&#34920;&#20855;&#26377;&#35768;&#22810;&#23376;&#34920;&#65292;&#20854;&#25551;&#36848;&#20851;&#20110;&#23383;&#27573;&#21644;&#26041;&#27861;&#20004;&#31181;&#31867;&#22411;&#30340;&#21512;&#32422;&#65306;&#26377;&#20123;&#36890;&#36807;&#23454;&#20363;&#21270;&#23545;&#35937;&#24433;&#21709;&#20351;&#29992;&#65292;&#26377;&#20123;&#24433;&#21709;&#23376;&#31867;&#12290;</p><h5>13.9.1<tt>&nbsp;</tt><a name="(part._.External-.Class-.Contracts)"></a>&#22806;&#37096;&#31867;&#21512;&#32422;</h5><p>&#22312;&#26368;&#31616;&#21333;&#30340;&#34920;&#20013;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">class/c</span></span></span>&#20445;&#25252;&#20174;&#21512;&#32422;&#31867;&#23454;&#20363;&#21270;&#30340;&#23545;&#35937;&#30340;&#20844;&#20849;&#23383;&#27573;&#21644;&#26041;&#27861;&#12290;&#36824;&#26377;&#19968;&#31181;<span class="RktSym"><span class="badlink"><span class="RktValLink">object/c</span></span></span>&#34920;&#65292;&#21487;&#29992;&#20110;&#31867;&#20284;&#22320;&#20445;&#25252;&#29305;&#23450;&#23545;&#35937;&#30340;&#20844;&#20849;&#23383;&#27573;&#21644;&#26041;&#27861;&#12290;&#33719;&#21462;<span class="RktSym">animal%</span>&#30340;&#20197;&#19979;&#23450;&#20041;&#65292;&#23427;&#20351;&#29992;&#20844;&#20849;&#23383;&#27573;&#20316;&#20026;&#20854;<span class="RktSym">size</span>&#23646;&#24615;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">animal%</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">field</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktVal">10</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">food</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">set!</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">get-field</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktSym">food</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#23545;&#20110;&#20219;&#20309;&#23454;&#20363;&#21270;&#30340;<span class="RktSym">animal%</span>&#65292;&#35775;&#38382;<span class="RktSym">size</span>&#23383;&#27573;&#24212;&#35813;&#36820;&#22238;&#19968;&#20010;&#27491;&#25968;&#12290;&#21478;&#22806;&#65292;&#22914;&#26524;&#35774;&#32622;&#20102;<span class="RktSym">size</span>&#23383;&#27573;&#65292;&#21017;&#24212;&#35813;&#20998;&#37197;&#19968;&#20010;&#27491;&#25968;&#12290;&#26368;&#21518;&#65292;<span class="RktSym">eat</span>&#26041;&#27861;&#24212;&#35813;&#25509;&#25910;&#19968;&#20010;&#21442;&#25968;&#65292;&#23427;&#26159;&#19968;&#20010;&#21253;&#21547;&#19968;&#20010;&#27491;&#25968;&#30340;<span class="RktSym">size</span>&#23383;&#27573;&#30340;&#23545;&#35937;&#12290;&#20026;&#20102;&#30830;&#20445;&#36825;&#20123;&#26465;&#20214;&#65292;&#25105;&#20204;&#23558;&#29992;&#36866;&#24403;&#30340;&#21512;&#32422;&#23450;&#20041;<span class="RktSym">animal%</span>&#31867;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">positive/c</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">and/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">number?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">positive?</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">edible/c</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">field</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktSym">positive/c</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/contract</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">animal%</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">field</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktSym">positive/c</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;m</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">edible/c</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">void?</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">field</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktVal">10</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">food</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">set!</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">get-field</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktSym">food</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#36825;&#37324;&#25105;&#20204;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;m</span></span></span>&#26469;&#25551;&#36848;<span class="RktSym">eat</span>&#30340;&#34892;&#20026;&#65292;&#22240;&#20026;&#25105;&#20204;&#19981;&#38656;&#35201;&#25551;&#36848;&#36825;&#20010;<span class="RktSym"><span class="badlink"><span class="RktValLink">this</span></span></span>&#21442;&#25968;&#30340;&#20219;&#20309;&#35201;&#27714;&#12290;&#26082;&#28982;&#25105;&#20204;&#26377;&#25105;&#20204;&#30340;&#21512;&#32422;&#31867;&#65292;&#23601;&#21487;&#20197;&#30475;&#20986;&#23545;<span class="RktSym">size</span>&#21644;<span class="RktSym">eat</span>&#30340;&#21512;&#32422;&#37117;&#26159;&#24378;&#21046;&#25191;&#34892;&#30340;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">bob</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">animal%</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">set-field!</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktSym">bob</span><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">get-field</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktSym">bob</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">3</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">set-field!</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktSym">bob</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">large</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">animal%: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">expected: positive/c</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">given: 'large</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: the size field in</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(class/c</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(eat</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(-&gt;m</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(object/c (field (size positive/c)))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">void?))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(field (size positive/c)))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: (definition animal%)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: top-level</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">at: eval:31.0</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">richie</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">animal%</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">bob</span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">richie</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">get-field</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktSym">bob</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">13</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">rock</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">bob</span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">rock</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">eat: contract violation;</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr">no public field size</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: the 1st argument of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">the eat method in</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(class/c</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(eat</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(-&gt;m</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(object/c (field (size positive/c)))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">void?))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(field (size positive/c)))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: (definition animal%)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract on: animal%</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: top-level</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">at: eval:31.0</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">giant</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">field</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">large</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">bob</span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">giant</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">eat: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">expected: positive/c</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">given: 'large</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: the size field in</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">the 1st argument of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">the eat method in</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(class/c</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(eat</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(-&gt;m</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(object/c (field (size positive/c)))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">void?))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(field (size positive/c)))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: (definition animal%)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract on: animal%</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: top-level</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">at: eval:31.0</span></p></td></tr></table></blockquote><p>&#23545;&#20110;&#22806;&#37096;&#31867;&#21512;&#21516;&#26377;&#20004;&#20010;&#37325;&#35201;&#30340;&#35686;&#21578;&#12290;&#39318;&#20808;&#65292;&#24403;&#21160;&#24577;&#20998;&#27966;&#30340;&#30446;&#26631;&#26159;&#21512;&#32422;&#31867;&#30340;&#26041;&#27861;&#23454;&#26045;&#26102;&#65292;&#21482;&#26377;&#22312;&#21512;&#21516;&#36793;&#30028;&#20869;&#25165;&#23454;&#26045;&#22806;&#37096;&#26041;&#27861;&#21512;&#21516;&#12290;&#37325;&#20889;&#35813;&#23454;&#29616;&#65292;&#20174;&#32780;&#25913;&#21464;&#21160;&#24577;&#20998;&#27966;&#30340;&#30446;&#26631;&#65292;&#23558;&#24847;&#21619;&#30528;&#19981;&#20877;&#20026;&#23458;&#25143;&#26426;&#24378;&#21046;&#25191;&#34892;&#35813;&#21512;&#32422;&#65292;&#22240;&#20026;&#35775;&#38382;&#35813;&#26041;&#27861;&#19981;&#20877;&#36234;&#36807;&#21512;&#32422;&#36793;&#30028;&#12290;&#19982;&#22806;&#37096;&#26041;&#27861;&#21512;&#32422;&#19981;&#21516;&#65292;&#22806;&#37096;&#23383;&#27573;&#21512;&#32422;&#23545;&#20110;&#23376;&#31867;&#30340;&#23458;&#25143;&#26426;&#24635;&#26159;&#24378;&#21046;&#25191;&#34892;&#65292;&#22240;&#20026;&#23383;&#27573;&#19981;&#33021;&#34987;&#35206;&#30422;&#25110;&#23631;&#34109;&#12290;</p><p>&#31532;&#20108;&#65292;&#36825;&#20123;&#21512;&#32422;&#19981;&#20197;&#20219;&#20309;&#26041;&#24335;&#38480;&#21046;<span class="RktSym">animal%</span>&#30340;&#23376;&#31867;&#12290;&#34987;&#23376;&#31867;&#32487;&#25215;&#21644;&#20351;&#29992;&#30340;&#23383;&#27573;&#21644;&#26041;&#27861;&#19981;&#34987;&#36825;&#20123;&#21512;&#32422;&#26816;&#26597;&#65292;&#24182;&#19988;&#36890;&#36807;<span class="RktSym"><span class="badlink"><span class="RktValLink">super</span></span></span>&#23545;&#22522;&#31867;&#26041;&#27861;&#30340;&#20351;&#29992;&#20063;&#19981;&#26816;&#26597;&#12290;&#19979;&#38754;&#30340;&#31034;&#20363;&#35828;&#26126;&#20102;&#20004;&#20010;&#35686;&#21578;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">large-animal%</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">animal%</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">inherit-field</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">set!</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">large</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/override</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">food</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">display</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">"Nom nom nom"</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">newline</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p>&nbsp;</p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">elephant</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">large-animal%</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">elephant</span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object%</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktOut">Nom nom nom</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">get-field</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktSym">elephant</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">animal%: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">promised: positive/c</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">produced: 'large</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: the size field in</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(class/c</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(eat</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(-&gt;m</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(object/c (field (size positive/c)))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">void?))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(field (size positive/c)))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: (definition animal%)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: (definition animal%)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">at: eval:31.0</span></p></td></tr></table></td></tr></table></blockquote><h5>13.9.2<tt>&nbsp;</tt><a name="(part._.Internal-.Class-.Contracts)"></a>&#20869;&#37096;&#31867;&#21512;&#32422;</h5><p>&#27880;&#24847;&#65292;&#20174;<span class="RktSym">elephant</span>&#23545;&#35937;&#26816;&#32034;<span class="RktSym">size</span>&#23383;&#27573;&#24402;&#21646;&#20110;<span class="RktSym">animal%</span>&#36829;&#21453;&#21512;&#32422;&#12290;&#36825;&#31181;&#24402;&#21646;&#26159;&#27491;&#30830;&#30340;&#65292;&#20294;&#23545;<span class="RktSym">animal%</span>&#31867;&#26469;&#35828;&#26159;&#19981;&#20844;&#24179;&#30340;&#65292;&#22240;&#20026;&#25105;&#20204;&#36824;&#27809;&#26377;&#25552;&#20379;&#19968;&#31181;&#20445;&#25252;&#33258;&#24049;&#20813;&#21463;&#23376;&#31867;&#25915;&#20987;&#30340;&#26041;&#27861;&#12290;&#20026;&#27492;&#25105;&#20204;&#28155;&#21152;&#20869;&#37096;&#31867;&#21512;&#32422;&#65292;&#23427;&#25552;&#20379;&#25351;&#20196;&#32473;&#23376;&#31867;&#20197;&#25351;&#26126;&#23427;&#20204;&#22914;&#20309;&#35775;&#38382;&#21644;&#37325;&#20889;&#22522;&#31867;&#30340;&#29305;&#24449;&#12290;&#22806;&#37096;&#31867;&#21644;&#20869;&#37096;&#31867;&#21512;&#32422;&#20043;&#38388;&#30340;&#21306;&#21035;&#22312;&#20110;&#26159;&#21542;&#20801;&#35768;&#31867;&#23618;&#27425;&#32467;&#26500;&#20013;&#36739;&#24369;&#30340;&#21512;&#32422;&#65292;&#20854;&#19981;&#21464;&#24615;&#21487;&#33021;&#34987;&#23376;&#31867;&#20869;&#37096;&#30772;&#22351;&#65292;&#20294;&#24212;&#36890;&#36807;&#23454;&#20363;&#21270;&#30340;&#23545;&#35937;&#24378;&#21046;&#29992;&#20110;&#22806;&#37096;&#20351;&#29992;&#12290;</p><p>&#20316;&#20026;&#21487;&#29992;&#30340;&#20445;&#25252;&#31867;&#22411;&#30340;&#31616;&#21333;&#31034;&#20363;&#65292;&#25105;&#20204;&#25552;&#20379;&#20102;&#19968;&#20010;&#38024;&#23545;<span class="RktSym">animal%</span>&#31867;&#30340;&#31034;&#20363;&#65292;&#23427;&#20351;&#29992;&#25152;&#26377;&#36866;&#29992;&#30340;&#34920;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">field</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktSym">positive/c</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">inherit-field</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktSym">positive/c</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;m</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">edible/c</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">void?</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;m</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">edible/c</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">void?</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;m</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">edible/c</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">void?</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">override</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;m</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">edible/c</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">void?</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#36825;&#20010;&#31867;&#21512;&#32422;&#19981;&#20165;&#30830;&#20445;<span class="RktSym">animal%</span>&#31867;&#30340;&#23545;&#35937;&#20687;&#20197;&#21069;&#19968;&#26679;&#21463;&#21040;&#20445;&#25252;&#65292;&#32780;&#19988;&#30830;&#20445;<span class="RktSym">animal%</span>&#31867;&#30340;&#23376;&#31867;&#21482;&#22312;<span class="RktSym">size</span>&#23383;&#27573;&#20013;&#23384;&#20648;&#36866;&#24403;&#30340;&#20540;&#65292;&#24182;&#36866;&#24403;&#22320;&#20351;&#29992;<span class="RktSym">animal%</span>&#30340;<span class="RktSym">size</span>&#23454;&#29616;&#12290;&#36825;&#20123;&#21512;&#32422;&#34920;&#21482;&#24433;&#21709;&#31867;&#23618;&#27425;&#32467;&#26500;&#20013;&#30340;&#20351;&#29992;&#65292;&#24182;&#19988;&#21482;&#24433;&#21709;&#36328;&#21512;&#32422;&#36793;&#30028;&#30340;&#26041;&#27861;&#35843;&#29992;&#12290;</p><p>&#36825;&#24847;&#21619;&#30528;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span>&#65288;&#32487;&#25215;&#65289;&#21482;&#20250;&#24433;&#21709;&#21040;&#19968;&#20010;&#26041;&#27861;&#30340;&#23376;&#31867;&#20351;&#29992;&#30452;&#21040;&#23376;&#31867;&#37325;&#20889;&#26041;&#27861;&#65292;&#32780;<span class="RktSym"><span class="badlink"><span class="RktValLink">override</span></span></span>&#21482;&#24433;&#21709;&#20174;&#22522;&#31867;&#36827;&#20837;&#26041;&#27861;&#30340;&#23376;&#31867;&#30340;&#37325;&#20889;&#23454;&#29616;&#12290;&#30001;&#20110;&#36825;&#20123;&#20165;&#24433;&#21709;&#20869;&#37096;&#20351;&#29992;&#65292;&#25152;&#20197;&#22312;&#20351;&#29992;&#36825;&#20123;&#31867;&#30340;&#23545;&#35937;&#26102;&#65292;override&#34920;&#19981;&#20250;&#33258;&#21160;&#23558;&#23376;&#31867;&#25554;&#20837;&#21040;&#20041;&#21153;&#65288;obligations&#65289;&#20013;&#12290;&#27492;&#22806;&#65292;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">override</span></span></span>&#20165;&#26159;&#35828;&#24471;&#36890;&#65292;&#22240;&#27492;&#21482;&#33021;&#29992;&#20110;&#27809;&#26377;beta&#26679;&#24335;&#22686;&#24378;&#30340;&#26041;&#27861;&#12290;&#19979;&#38754;&#30340;&#31034;&#20363;&#26174;&#31034;&#20102;&#36825;&#31181;&#24046;&#24322;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/contract</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">sloppy-eater%</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;m</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">edible/c</span><span class="hspace">&nbsp;</span><span class="RktSym">edible/c</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">begin</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/contract</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">glutton%</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">override</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;m</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">edible/c</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">void?</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">animal%</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">inherit</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/public</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">gulp</span><span class="hspace">&nbsp;</span><span class="RktSym">food-list</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">for</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">f</span><span class="hspace">&nbsp;</span><span class="RktSym">food-list</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">f</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">class</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">glutton%</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">super-new</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">inherit-field</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define/override</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">f</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">let</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">food-size</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">get-field</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktSym">f</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">set!</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">/</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">food-size</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">set-field!</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktSym">f</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">/</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">food-size</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">f</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">pig</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">sloppy-eater%</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">slop1</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">animal%</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">slop2</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">animal%</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">slop3</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">animal%</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">pig</span><span class="hspace">&nbsp;</span><span class="RktSym">eat</span><span class="hspace">&nbsp;</span><span class="RktSym">slop1</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">(object:animal% ...)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">get-field</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">size</span><span class="hspace">&nbsp;</span><span class="RktSym">slop1</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">5</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">pig</span><span class="hspace">&nbsp;</span><span class="RktSym">gulp</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">slop1</span><span class="hspace">&nbsp;</span><span class="RktSym">slop2</span><span class="hspace">&nbsp;</span><span class="RktSym">slop3</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">eat: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">promised: void?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">produced: (object:animal% ...)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: the range of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">the eat method in</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(class/c</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(override (eat</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(-&gt;m</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(object/c</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(field (size positive/c)))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">void?))))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: (definition glutton%)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract on: glutton%</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: (definition sloppy-eater%)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">at: eval:47.0</span></p></td></tr></table></blockquote><p>&#38500;&#20102;&#36825;&#37324;&#30340;&#20869;&#37096;&#31867;&#21512;&#32422;&#34920;&#25152;&#26174;&#31034;&#30340;&#20043;&#22806;&#65292;&#36825;&#37324;&#26377;beta&#26679;&#24335;&#21487;&#25193;&#23637;&#30340;&#26041;&#27861;&#31867;&#20284;&#30340;&#34920;&#12290;<span class="RktSym"><span class="badlink"><span class="RktValLink">inner</span></span></span>&#34920;&#25551;&#36848;&#20102;&#36825;&#20010;&#23376;&#31867;&#65292;&#23427;&#34987;&#35201;&#27714;&#20174;&#19968;&#20010;&#32473;&#23450;&#30340;&#26041;&#27861;&#25193;&#23637;&#12290;<span class="RktSym"><span class="badlink"><span class="RktValLink">augment</span></span></span>&#21644;<span class="RktSym"><span class="badlink"><span class="RktValLink">augride</span></span></span>&#21578;&#35785;&#23376;&#31867;&#65292;&#35813;&#32473;&#23450;&#30340;&#26041;&#27861;&#26159;&#19968;&#31181;&#34987;&#22686;&#24378;&#30340;&#26041;&#27861;&#65292;&#24182;&#19988;&#23545;&#23376;&#31867;&#26041;&#27861;&#30340;&#20219;&#20309;&#35843;&#29992;&#23558;&#21160;&#24577;&#20998;&#37197;&#21040;&#22522;&#31867;&#20013;&#30456;&#24212;&#30340;&#23454;&#29616;&#12290;&#36825;&#26679;&#30340;&#35843;&#29992;&#23558;&#26681;&#25454;&#32473;&#23450;&#30340;&#21512;&#32422;&#36827;&#34892;&#26816;&#26597;&#12290;&#36825;&#20004;&#31181;&#34920;&#30340;&#21306;&#21035;&#22312;&#20110;<span class="RktSym"><span class="badlink"><span class="RktValLink">augment</span></span></span>&#30340;&#20351;&#29992;&#24847;&#21619;&#30528;&#23376;&#31867;&#21487;&#20197;&#22686;&#24378;&#32473;&#23450;&#30340;&#26041;&#27861;&#65292;&#32780;<span class="RktSym"><span class="badlink"><span class="RktValLink">augride</span></span></span>&#30340;&#20351;&#29992;&#34920;&#31034;&#23376;&#31867;&#24517;&#39035;&#21453;&#32780;&#37325;&#20889;&#24403;&#21069;&#22686;&#24378;&#12290;</p><p>&#36825;&#24847;&#21619;&#30528;&#24182;&#19981;&#26159;&#25152;&#26377;&#30340;&#34920;&#37117;&#21487;&#20197;&#21516;&#26102;&#20351;&#29992;&#12290;&#21482;&#26377;<span class="RktSym"><span class="badlink"><span class="RktValLink">override</span></span></span>&#12289;<span class="RktSym"><span class="badlink"><span class="RktValLink">augment</span></span></span>&#21644;<span class="RktSym"><span class="badlink"><span class="RktValLink">augride</span></span></span>&#20013;&#30340;&#19968;&#20010;&#34920;&#21487;&#29992;&#20110;&#19968;&#20010;&#32473;&#23450;&#30340;&#26041;&#27861;&#65292;&#32780;&#22914;&#26524;&#32473;&#23450;&#30340;&#26041;&#27861;&#24050;&#32463;&#23436;&#25104;&#65292;&#36825;&#20123;&#34920;&#27809;&#26377;&#19968;&#20010;&#21487;&#20197;&#20351;&#29992;&#12290;&#27492;&#22806;&#65292; &#20165;&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">augride</span></span></span>&#25110;<span class="RktSym"><span class="badlink"><span class="RktValLink">override</span></span></span>&#21487;&#20197;&#25351;&#23450;&#26102;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">super</span></span></span>&#21487;&#20197;&#34987;&#25351;&#23450;&#20026;&#19968;&#20010;&#32473;&#23450;&#30340;&#26041;&#27861;&#12290;&#21516;&#26679;&#65292;&#21482;&#26377;<span class="RktSym"><span class="badlink"><span class="RktValLink">augment</span></span></span>&#25110;<span class="RktSym"><span class="badlink"><span class="RktValLink">augride</span></span></span>&#21487;&#20197;&#25351;&#23450;&#26102;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">inner</span></span></span>&#21487;&#20197;&#34987;&#25351;&#23450;&#12290;</p><div class="navsetbottom"><span class="navleft"><div class="nosearchform"></div>&nbsp;&nbsp;</span><span class="navright">&nbsp;&nbsp;<a href="match.html" title="backward to &quot;12 模式匹配&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;Racket指南&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="units.html" title="forward to &quot;14 单元（组件）&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>